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):
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?
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...
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...