Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

the SQLNestedException makes my crazy  RSS feed

 
Oren andJava
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi people

days are passing and I m still stuck with the same problem : SQLNestedException:

I put the mysql-connector-java-3.0.15-ga-bin.jar in C:\j2sdk1.4.2_05\jre\lib\ext
I created a System variable CLASSPATH pointing to C:\j2sdk1.4.2_05\jre\lib\ext\mysql-connector-java-3.0.15-ga-bin.jar

I tried the Jakarta example http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

web.xml:
<web-app>
<description>MySQL Test App</description>
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/TestDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>

server.xml:
<Server port="8005" shutdown="SHUTDOWN">
<GlobalNamingResources>
<!-- Used by Manager webapp -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>

</GlobalNamingResources>

<Service name="Catalina">
<Connector port="8080" />

<!-- This is here for compatibility only, not required -->
<Connector port="8009" protocol="AJP/1.3" />

<Engine name="Catalina" defaultHost="localhost">
<Logger className="org.apache.catalina.logger.FileLogger" />

<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase" />

<Host name="localhost" appBase="webapps" />

<context path="/DBTest" docBase="DBTest" debug="1" reloadable="true">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_DBTest_log." suffix=".txt" timestamp="true"/>
<Resource name="jdbc/DBTest" auth="Container" type="javax.sql.DataSource" />
<ResourceParams name="jdbc/DBTest">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>user</name>
<value>my_username</value>
</parameter>
<parameter>
<name>password</name>
<value>my_password</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost/javatest</value>
</parameter>
</ResourceParams>
</context>

</Engine>
</Service>
</Server>

I did all the steps BUT I got the fucking exception :
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'

I did the same prog that is using a Main class (without TOMCAT) and it s working fine


please answer me


THANK U
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
server configration(startup) file might be setting some classpath for it's own environment.
 
Oren andJava
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and ?
 
Oren andJava
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
problem solved
 
Oren andJava
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I forget to write the solution

SOLUTION for SQLNestedException on tomcat 4.x, 5.x, using JDBC/JNDI
org.apache.commons.dbcp.org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'

it seems that Tomcat doesn't boot correctly the resource (jndi) from server.xml so you get the SQLNestedException; so leave the server.xml to the strict mininum.
in <CATALINA_HOME>/conf/[engine_name]/[host_name] create your_app.xml with the Context you previously put in server.xml
restart Tomcat so now Tomcat will use this context when booting.

Oren owns Java....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!