[jboss-user] [JNDI/Naming/Network] - mdb can use datasource but servlet cannot

alecbrecher do-not-reply at jboss.com
Wed Nov 19 11:11:31 EST 2008


I have struggled with a situation where a message driven bean is able to connect to a datasource using the jndi name: java:/actn_shw but a servlet in the same ear cannot find the same datasource.  Any suggestions would be greatly appreciated.

No NamingException is thrown when the datasource is retrieved from the initial context but the DataSource is null.


jboss AS 4.2.0 default server

2008-11-19 11:05:22,258 INFO  [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=actn_shw' to JNDI name 'java:actn_shw'

-ds.xml:
<local-tx-datasource>
    <jndi-name>actn_shw</jndi-name>
   <connection-url>jdbc:postgresql://dbhost:5432/shw</connection-url>
    <driver-class>org.postgresql.Driver</driver-class>
    ...

web.xml:
    <resource-ref>
    	<res-ref-name>jdbc/actn_shw</res-ref-name>
    	<res-type>javax.sql.DataSource</res-type>
    	<res-auth>Container</res-auth>
    </resource-ref>

jboss-web.xml:
	<resource-ref>
		<res-ref-name>jdbc/actn_shw</res-ref-name>
		<jndi-name>java:/actn_shw</jndi-name>
	</resource-ref>

No NamingException is thrown when the datasource is retrieved from the initial context but the DataSource is null.


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

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



More information about the jboss-user mailing list