wood burning stoves 2.0*
The moose likes Tomcat and the fly likes SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' (Hibernate + Seam) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "SQLNestedException: Cannot create JDBC driver of class Watch "SQLNestedException: Cannot create JDBC driver of class New topic
Author

SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' (Hibernate + Seam)

Karsten Wutzke
Ranch Hand

Joined: Jul 20, 2010
Posts: 106

OK now I'm totally baffled. I had been successfully using Tomcat 6 with a single datasource defined in the webapp's context for some time. Then I ported the webapp to JBoss AS 6.0. When I switched my config back to Tomcat suddenly I got an exception when starting the server (along with my Hibernate/Seam webapp):

Note I'm using JBoss Seam (SeamListener in WEB-INF/web.xml) as configured here:
http://seamframework.org/Documentation/RunningASeamgenProjectOnApacheTomcatWithoutEmbeddedJBoss

context.xml:persistence.xml:components.xml:
web.xml:
I put the MySQL Connector JAR into tomcat/lib, which seems to be correct. Hibernate, its dependencies, JSF, Facelets, and Seam JARs were copied into the webapp lib dir later ending up in the deployed webapp's dir /WEB-INF/lib. persistence.xml ends up in /WEB-INF/classes/META-INF, context.xml in /META-INF. It all appears to be correct.

The strange thing about the Tomcat startup output is that even though this exception is thrown, I can still use the webapp without any problems, either through my HttpServlet or the FacesServlet.

Another strange observation I made is that whenever I change and save the webapp's web.xml in Eclipse using WTP (it triggers an automatic server restart) then no such an exception occurrs at all!

Really strange. But it hints that there is a very specific issue with Tomcat and the context datasource. Could it be Hibernate (doubts...)?

Do you have any ideas what could be wrong?

Karsten

PS: Maybe this is too complex to solve as anyone can only speculate about the problem here. Probably the final argument to drop Tomcat entirely and move on to JBoss...


OCJP JavaSE 6 (86%)
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
Try in context.xml:

>
Karsten Wutzke
Ranch Hand

Joined: Jul 20, 2010
Posts: 106

Try the jdbc prefix in persistence.xml and web.xml, too? IIRC the jdbc thing isn't necessary. It's just a convention.

Karsten
Karsten Wutzke
Ranch Hand

Joined: Jul 20, 2010
Posts: 106

OK, just tried it with jdbc before the DS name, no changes.

Any other ideas?

Karsten
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
I guess it just does not see context.xml in /META-INF
Karsten Wutzke
Ranch Hand

Joined: Jul 20, 2010
Posts: 106

Yes that could really be the case, but how do I check whether that file is picked up or not?

The next question would be why the webapp itself is working without the context.xml datasource. I happen to have a hibernate.properties in the same path as persistence.xml which I needed for JBoss Tools' HQL editor to specify the driver, URL etc. However, IIRC I've deleted that file from the server webapp dir, but there was no change. The DB can be accessed at all times. It's really strange. Maybe I should package my webapp and see if other can get it to work on their Tomcats (it's not a critical webapp). I'd probably have to switch from MySQL to HSQLDB and strip some data and classes. I'm pretty tired of trying...

Karsten
Karsten Wutzke
Ranch Hand

Joined: Jul 20, 2010
Posts: 106

BTW, there's the line:



...

Karsten
Karsten Wutzke
Ranch Hand

Joined: Jul 20, 2010
Posts: 106

I've also tried the Context element in conf/server.xml (localhost Host element) to no avail. Always the very same exception. It's strange.
 
wood burning stoves
 
subject: SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' (Hibernate + Seam)
 
Similar Threads
Not able to access Session Bean in Seam Framework
Spring & Seam integration problem
issues integrating seam2.1.1 and facelets 1.1.14 to myfaces 1.25, spring 2.5 and hibernate 3.4 app
jsf and jstl
What's wrong(Hibernate.cfg.xml + Components.xml + Context.xml) on tomcat