You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mark Fleischman <ma...@digitalconnectcommunications.com> on 2004/11/09 01:07:26 UTC
Datasource problems on Tomcat 5.5.4
Hello,
After upgrading from Tomcat 5.0.27 to Tomcat 5.5.4 my JNDI datasources are
not resolving in 5.5.4
I tried 2 approaches which both work in Tomcat 5.0.27. I am using the same
configuration on the 5.5.4 version (that is my libraries and context files
have not changed)
1) DBCP with MySql
2) c3p0 with MySql
With DBCP I get:
> JDBC driver of class '' for connect URL 'null'
With c3p0 I get:
> javax.naming.NamingException: Cannot create resource instance
I am more interested in resolving the c3p0 JNDI datasource setup. So let me
share that setup:
Here are the details of what I am running:
c3p0-0.8.5pre4
mysql-connector-java-3.0.15-ga-bin
JDK 1.5.0
Tomcat 5.5.4
On Windows
Inside of common/lib I have placed the above JDBC related libraries.
Here is my context file (which is placed in the conf\Catalina\localhost
directory):
<Context path="/myapp" docBase="myapp.war"
debug="5" reloadable="true" override="true" crossContext="true">
<Resource name="jdbc/DCCDS" auth="Container"
type="com.mchange.v2.c3p0.ComboPooledDataSource"/>
<ResourceParams name="jdbc/DCCDS">
<parameter>
<name>factory</name>
<value>org.apache.naming.factory.BeanFactory</value>
</parameter>
<parameter>
<name>driverClass</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>jdbcUrl</name>
<value>jdbc:mysql://192.168.1.60:3306/dcc_dev?autoReconnect=true;</value>
</parameter>
<parameter>
<name>user</name>
<value>mark</value>
</parameter>
<parameter>
<name>password</name>
<value>xxxxxxx</value>
</parameter>
<parameter>
<name>minPoolSize</name>
<value>5</value>
</parameter>
<parameter>
<name>maxPoolSize</name>
<value>15</value>
</parameter>
<parameter>
<name>acquireIncrement</name>
<value>5</value>
</parameter>
</ResourceParams>
</Context>
Here the relevant part of the web.xml file:
<resource-ref>
<description>DB Connection On My Sql</description>
<res-ref-name>jdbc/DCCDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
When I make the following call in java:
envCtx.lookup("jdbc/DCCDS");
I get the exception:
javax.naming.NamingException: Cannot create resource instance
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.
java:132)
javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
Any help would be greatly appreciated.
Thanks,
Mark