users@glassfish.java.net

Glassfish, MySQL and _at_Resource

From: <glassfish_at_javadesktop.org>
Date: Sun, 08 Jun 2008 16:09:37 PDT

Hello.

Creating a simple Servlet to check if my db-connection for mysql is ok.
I did download the latest Connector from Mysql which is Connector /J 5.1
Copying the jar:file to the C:\app\glassfish\domains\domain1\lib\ext-directory.

I seem to get a NullPointerException running the below code,
datasource is never set, it is null .... Do I have to do anything special to get the DI-working ?
My JAVA_HOME is set to: C:\Program Files\Java\jdk1.6.0_03

public class JDBCSelectServlet extends javax.servlet.http.HttpServlet {
         @Resource(name="jdbc/__MysqlPool")
         private DataSource dataSource;

Hope that you can give me a hand.

reagards, i
[Message sent by forum member 'invergilius' (invergilius)]

http://forums.java.net/jive/thread.jspa?messageID=279021