Hello,

I am using Jboss 4.0 3 SP1 with Java SDK 1.5.
I would simply like to use a datasource (mysql) from a servlet but I get a 
"Could not dereference object exception" when doing :

Context initCtx = new InitialContext();
Context envCtx = (Context)initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)envCtx.lookup("joueurDB"); 

Here is my web.xml:

<resource-ref>
<res-ref-name>joueurDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

Here is my jboss-web.xml:

<jboss-web>
<resource-ref>
<res-ref-name>joueurDB</res-ref-name>
<jndi-name>joueurDB</jndi-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</jboss-web>

Here is my mysql-ds.xml: (relevant extract)


 <local-tx-datasource>
 <jndi-name>joueurDB</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/test</connection-url>
 <driver-class>com.mysql.jdbc.Driver</driver-class>

Here is the JNDI binding log message at server start-up?
ConnectionFactoryBindingService] Bound ConnectionManager 
'jboss.jca:service=DataSourceBinding,name=joueurB' to JNDI name 'java:joueurDB'

What is wrong please? THank you very much in advance for help.



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3923254#3923254

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3923254


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to