You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Iran Marcius <ir...@isic.com.br> on 2002/12/20 15:05:45 UTC
Is there a problem with tomcat JNDI resources (I don't think so)
Hi fellows.
I think I'm doing something wrong, but I can't get a JNDI Datasource
configured in GlobalNamingResource section.
Here is my configuration:
<Resource name="jdbc/global" type="javax.sql.DataSource"
auth="Container" scope="Shareable"/>
<ResourceParams name="jdbc/global">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.postgresql.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:postgresql://localhost/global</value>
</parameter>
<parameter>
<name>validationQuery</name>
<value>select 1</value>
</parameter>
<parameter>
<name>username</name>
<value>global</value>
</parameter>
<parameter>
<name>password</name>
<value>password</value>
</parameter>
</ResourceParams>
In my context I have the following:
<Context docBase="s:\webapptests" path="/tests" reloadable="true"
debug="4">
<ResourceLink name="jdbc/global" global="jdbc/global"
type="javax.sql.DataSource"/>
</Context>
But when I perform the lookup operations in my servlet, got the
following error:
javax.servlet.ServletException: Name java:comp is not bound in this
Context
at org.apache.naming.NamingContext.list(NamingContext.java:386)
at org.apache.naming.NamingContext.list(NamingContext.java:409)
at javax.naming.InitialContext.list(InitialContext.java:387)
at com.isic.tests.JNDITestServlet.doGet(JNDITestServlet.java:27)
My lookup line is: DataSource ds =
(DataSource)ic.lookup("java:comp/env/jdbc/global"); Is it correct?
Sometimes I got really confused about these names.
Am I missing some configuration in context or web.xml (is resource-ref
necessary?).
My application is running in a virtual host I created (with a
SingleSignOn valve). Could it be the problem?
Thanks for any help.
iran
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>