Tomcat BasicDataSourceFactory class not found due to incompatible location in libcommons-dbcp-java

Bug #315314 reported by Eric P
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
libcommons-dbcp-java (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: libcommons-dbcp-java

Disclaimer: I'm pretty much a Java/Tomcat newb (go easy on me ;).

Ubuntu 8.10's libcommons-dbcp-java package provides the BasicDataSourceFactory class here:
org.apache.commons.dbcp.BasicDataSourceFactory.class

However, Ubuntu 8.10's Tomcat 6 doesn't find the class as it is looking here:
org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory

Here is the relavant warning that appears in the catalina log file on a default Tomcat 6 install on Ubuntu 8.10.
org.apache.catalina.core.NamingContextListener addResource
WARNING: Failed to register in JMX: javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]

Trying to add a JDBC datasource in the conf/context.xml file doesn't work and produces only more of the above warning. So the default Tomcat 6 install on Ubuntu 8.10 is effectively broken in its current state.

Distro/package versions:
Ubuntu - 8.10
libcommons-dbcp-java - 1.2.2-1ubuntu1
tomcat6* - 6.0.18-0ubuntu3
libtomcat6-java - 6.0.18-0ubuntu3
libservlet2.5-java - 6.0.18-0ubuntu3

Thanks and let me know if I can provide further details.
Eric P

Tags: tomcat
Revision history for this message
Magne Rasmussen (magne-rasmussen) wrote :

For a quick work-around, extract tomcat-dbcp.jar from the base Tomcat 6.0.18 distribution from Apache, and place it under /usr/share/tomcat6/lib. Also remove the symbolic links to commons-dbcp.jar and commons-pool.jar from this directory.
Please note that the Ubuntu 8.10 Tomcat6 distribution is completely hosed; you must place the JDBC driver jar into /usr/share/tomcat6/lib directory for it to be found, NOT, as you would think, in the /var/lib/tomcat6/lib directory. It seems like the 8.10 Tomcat6 distribution ignores this directory when building the classpath!

Revision history for this message
Thierry Carrez (ttx) wrote :

Magne:

Tomcat6 is run with CATALINA_HOME set to /usr/share/tomcat6 and CATALINA_BASE set to /var/lib/tomcat6. If you read the Tomcat RUNNING.txt doc (available at /usr/share/doc/tomcat6-common/RUNNING.txt.gz) you'll see that Tomcat6 is looking at libraries at CATALINA_HOME/lib and doesn't look into CATALINA_BASE/lib. So the current behavior is following the spec.

I agree that since it is ignored, the presence of a CATALINA_BASE/lib directory is, at best, confusing. Could you please file a new bug about that so that I can properly take care of that issue ?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.