File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes SQLNestedException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "SQLNestedException" Watch "SQLNestedException" New topic


kwame Iwegbue
Ranch Hand

Joined: Sep 02, 2000
Posts: 197
Can someone help with this Exception.

I am using Tomcat 5.5 ..
here is the complete stack trace

This is CATALINA_HOME/conf/context.xml

[ June 10, 2006: Message edited by: kwame Iwegbue ]

Who dares, wins! (SAS motto)
John G Martinson

Joined: Jul 25, 2005
Posts: 8
With out your code, which can be extensive, it looks like somewhere you are trying to load a class named "for connect URL 'null'"

One thing i would like to see is what your hopenet.utils.ConnectionUtil.getConnection() looks like. This appears to be where the problem actually is

A little wiser for the wear.
kwame Iwegbue
Ranch Hand

Joined: Sep 02, 2000
Posts: 197
seems to work when <Resource> is placed in CATALINA_HOME/conf/server.xml under <GlobalNamingResources> and then place <ResourceLink> in the context.xml file.
kwame Iwegbue
Ranch Hand

Joined: Sep 02, 2000
Posts: 197
I have finally figured this out!!!

(This should probably be in Tomcat section, instead of here in JDBC)

From what I've seen in several other forums online regarding this problem, there might be either a bug in Tomcat v5.5, or the issue is not yet properly documented.

When trying to configure a web applications to access JDBC by using a DataSource to return a java.sql.Conncetion from Connection pool, you might encounter an
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'

This occurs when trying to run this type of code:

I believe it could be because there was a problem creating the Context. This could be fixed by using 'attributes' in <Resource> tag of <Context> element, instead of <Parameter> as in prev Tomcat versions, then by placing <Resource> in CATALINA_HOME/conf/server.xml under <GlobalNamingResources> and then place a <ResourceLink> in the context.xml file.

Problem is, when trying to perform

you might still get a
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

So next you need to place a factory attribute in <Resource>. There is a default factory provided by Tomcat v5.5, but this doesn't seen to work for Connection pooling. So you can use


This works whether <Resource> is defined under <GlobalNamingResources> in server.xml for global access, and then <ResourceLink> is defined under <Context> for each application, or if <Resource> is placed under <Context> only. An example (saved as /META-INF/context.xml):

I hope this is helpful to someone!
[ June 15, 2006: Message edited by: kwame Iwegbue ]
I agree. Here's the link:
subject: SQLNestedException
jQuery in Action, 3rd edition