You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Cavan Morris <cm...@paycom.net> on 2003/04/14 23:17:04 UTC
DBCP JNDI problem
I have the weirdest problem I have ever seen, which probably means I'm doing
something stupid, but I'm stumped. I set up DBCP with JNDI as described in
the documentation and modified my code to use it. Now, whenever I request a
Connection I get the following error.
java.lang.NoClassDefFoundError: tyrex/jdbc/xa/EnabledDataSource
at
org.apache.naming.factory.TyrexDataSourceFactory.getObjectInstance(TyrexDataSourceFactory.java:166)
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:164)
at
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:311)
at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
So the relevant question is... Why the hell is it trying to use a Tyrex
factory when I have the configuration below.
<Resource name="jdbc/MyDB" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/MyDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>50</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>0</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>180000</value>
</parameter>
<parameter>
<name>username</name>
<value>myname</value>
</parameter>
<parameter>
<name>password</name>
<value>mypass</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://Myserver/Mydb?autoReconnect=true</value>
</parameter>
</ResourceParams>
As always, any thoughts would be greatly appreciated.
-Cavan Morris
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: DBCP JNDI problem
Posted by Cavan Morris <cm...@paycom.net>.
Yah, I took a look in the source code and figured that out, but that points to
another problem. Tomcat doesn't seem to be picking up any of the
resourceParams for my resource. The DBCP factory was set there so I hard
coded it into a system property and sure enough it started complaining about
not being able to load JDBC Driver class 'null'. Since the driver was
another parameter I set in the config file I'm pretty sure it's not picking
up any of them. The new error is below. Any reason why tomcat wouldn't be
picking up <ResourceParams>. I am using 4.0.6 by the way.
java.sql.SQLException: Cannot load JDBC driver class 'null'
at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:529)
at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
My config is in the previous letter below.
Once again, Help!
-Cavan Morris
On Monday 14 April 2003 14:36, Jacob Kjome wrote:
> If you are using tomcat 4.0 or an early release of Tomcat 4.1, then it uses
> Tyrex by default rather than DBCP. Grab Tomcat-4.1.24. Things should
> work.
>
> Jake
>
> At 02:17 PM 4/14/2003 -0700, you wrote:
> >I have the weirdest problem I have ever seen, which probably means I'm
> > doing something stupid, but I'm stumped. I set up DBCP with JNDI as
> > described in the documentation and modified my code to use it. Now,
> > whenever I request a Connection I get the following error.
> >
> > java.lang.NoClassDefFoundError: tyrex/jdbc/xa/EnabledDataSource
> >at
> >org.apache.naming.factory.TyrexDataSourceFactory.getObjectInstance(TyrexDa
> >taSourceFactory.java:166) at
> >org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactor
> >y.java:164) at
> >javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:311)
> > at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
> > at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
> > at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
> > at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
> >
> >So the relevant question is... Why the hell is it trying to use a Tyrex
> >factory when I have the configuration below.
> >
> ><Resource name="jdbc/MyDB" auth="Container" type="javax.sql.DataSource"/>
> > <ResourceParams name="jdbc/MyDB">
> > <parameter>
> > <name>factory</name>
> >
> ><value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> > </parameter>
> > <parameter>
> > <name>maxActive</name>
> > <value>50</value>
> > </parameter>
> > <parameter>
> > <name>maxIdle</name>
> > <value>0</value>
> > </parameter>
> > <parameter>
> > <name>maxWait</name>
> > <value>180000</value>
> > </parameter>
> > <parameter>
> > <name>username</name>
> > <value>myname</value>
> > </parameter>
> > <parameter>
> > <name>password</name>
> > <value>mypass</value>
> > </parameter>
> > <parameter>
> > <name>driverClassName</name>
> > <value>com.mysql.jdbc.Driver</value>
> > </parameter>
> > <parameter>
> > <name>url</name>
> >
> ><value>jdbc:mysql://Myserver/Mydb?autoReconnect=true</value>
> > </parameter>
> > </ResourceParams>
> >
> >As always, any thoughts would be greatly appreciated.
> >
> >-Cavan Morris
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: DBCP JNDI problem
Posted by Jacob Kjome <ho...@visi.com>.
If you are using tomcat 4.0 or an early release of Tomcat 4.1, then it uses
Tyrex by default rather than DBCP. Grab Tomcat-4.1.24. Things should work.
Jake
At 02:17 PM 4/14/2003 -0700, you wrote:
>I have the weirdest problem I have ever seen, which probably means I'm doing
>something stupid, but I'm stumped. I set up DBCP with JNDI as described in
>the documentation and modified my code to use it. Now, whenever I request a
>Connection I get the following error.
>
> java.lang.NoClassDefFoundError: tyrex/jdbc/xa/EnabledDataSource
>at
>org.apache.naming.factory.TyrexDataSourceFactory.getObjectInstance(TyrexDataSourceFactory.java:166)
> at
>org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:164)
> at
>javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:311)
> at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
> at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
> at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
> at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
>
>So the relevant question is... Why the hell is it trying to use a Tyrex
>factory when I have the configuration below.
>
><Resource name="jdbc/MyDB" auth="Container" type="javax.sql.DataSource"/>
> <ResourceParams name="jdbc/MyDB">
> <parameter>
> <name>factory</name>
>
><value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> </parameter>
> <parameter>
> <name>maxActive</name>
> <value>50</value>
> </parameter>
> <parameter>
> <name>maxIdle</name>
> <value>0</value>
> </parameter>
> <parameter>
> <name>maxWait</name>
> <value>180000</value>
> </parameter>
> <parameter>
> <name>username</name>
> <value>myname</value>
> </parameter>
> <parameter>
> <name>password</name>
> <value>mypass</value>
> </parameter>
> <parameter>
> <name>driverClassName</name>
> <value>com.mysql.jdbc.Driver</value>
> </parameter>
> <parameter>
> <name>url</name>
>
><value>jdbc:mysql://Myserver/Mydb?autoReconnect=true</value>
> </parameter>
> </ResourceParams>
>
>As always, any thoughts would be greatly appreciated.
>
>-Cavan Morris
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org