[jboss-user] [JNDI/Naming/Network] - Getting DB connection from jboss pool via JNDI

amayen do-not-reply at jboss.com
Mon Jun 29 04:41:09 EDT 2009


Hi!


I have a problem with the look up of a database resource.
I have the following setup:

One standalone Tomcat 5.x
One standalone JBoss 4.x

They are both running on the same pyhsical host machine.

The Jboss is configured with a datasource *-ds.xml. This can be used by the EJB's running inside JBOSS.

The JSP's running in Tomcat are also sometimes trying to get the datasource from JBoss via JNDI. That fails if I do not set <use-java-context>false</...>.

But as I read setting this property to true is an anti pattern (and I'm seeing errors over time getting db connections which did not occur before).

Furthermore the application seems to have been running with this setup without even mentioning <use-java-context/> (The default should be true, shouldn't it?) very successful.

So my question is if it could be possible somehow that this setup can work without setting <use-java-context/> to false (It seemed to have worked that way, but all I'm reading suggests that this does never ever work)?

And second, what is the preferred way to let tomcat access the database resource via jndi (where jboss and tomcat run in the same machine but in different jvm instances)?


I also tried setting up a reference in web.xml and jboss-web.xml which I put into the WEB-INF directory.

Here the contents:

web.xml:

<resource-ref>
   fdjlf
   <res-ref-name>java:postgresqlDS</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <res-auth>Container</res-auth>
<resource-ref>

jboss-web.xml:


<resource-ref>
   fdjlf
   <res-ref-name>java:postgresqlDS</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <jndi-name>java:postgresqlDS</jndi-name>
<resource-ref>

Does this web.xml jboss-web.xml configuration only work for stuff put into the global namespace of jndi?

Thanks for any answers!

Kind regards,

Anatol

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

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



More information about the jboss-user mailing list