aspose file tools*
The moose likes Tomcat and the fly likes javax.naming.NamingException: Could not load resource factory class [Root exception i Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "javax.naming.NamingException: Could not load resource factory class [Root exception i" Watch "javax.naming.NamingException: Could not load resource factory class [Root exception i" New topic
Author

javax.naming.NamingException: Could not load resource factory class [Root exception i

Y Jadhav
Ranch Hand

Joined: Oct 02, 2008
Posts: 37
Oct 14, 2008 9:16:16 PM org.apache.catalina.core.NamingContextListener addResource
WARNING: Failed to register in JMX: javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSourceFactory]
Oct 14, 2008 9:16:16 PM org.apache.catalina.core.NamingContextListener addResource
WARNING: Failed to register in JMX: javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSourceFactory]
Oct 14, 2008 9:16:16 PM org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080


what this error is about,

i added all required jar files still error is there..
M Martinez
Greenhorn

Joined: Oct 14, 2008
Posts: 1
I'm new to Java Web Development and had a very similar error, but for the life of me could not figure it out.

My setup was:
Tomcat 6.0.14
MySQL Connector/J 5.1.6

I managed to get a test application working with the following settings in my application's META-INF/context.xml:



But could not get it working for my main application. I then decided to look and see if the context for my main application was being set anywhere else (such as in the Tomcat conf directory) and sure enough, there it was in the following directory:

$CATALINA_BASE/conf/Catalina/localhost/mainapp.xml

using the attribute factory="org.apache.commons.dbcp.BasicDataSourceFactory" in the <Resource> element. This setting was part of a previous attempt of mine that failed since Tomcat 6 uses the factory org.apache.tomcat.dbcp.BasicDataSourceFactory. According to the Tomcat 6 documentation, Tomcat will load the XML file in $CATALINA_BASE/conf/[enginename]/[hostname]/ before it moves on the the application's META-INF directory if it doesn't find it. For some reason Tomcat was copying my application's META-INF/context.xml to that directory (strangely enough not my test application's though) and NOT refreshing every time I made changes in my application directory. Once I removed the mentioned xml and restarted the server, everything worked perfectly. But again, Tomcat has copied my (working) context.xml file to that directory, ready to give me another headache the next time I try to change my Resource settings... (any thoughts on how to stop this would be GREATLY appreaciated)

I hope this helps!
 
Don't get me started about those stupid light bulbs.
 
subject: javax.naming.NamingException: Could not load resource factory class [Root exception i