Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having trouble running a script which should rebuild the database for a web service (the Fedora Commons digital repository) which normally runs inside Tomcat 6 (stock Debian version). I'm running it on Debian 6, and though Tomcat starts okay, the rebuild script which I must invoke before running Tomcat is hitting the following problem:

ERROR 2010-10-11 13:26:38.836 [main] (Server) Fatal error while starting server
java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
 at org.apache.commons.dbcp.BasicDataSource.createConnectionPool( [na:Nightly-201002202152]
 at org.apache.commons.dbcp.BasicDataSource.createDataSource( [na:Nightly-201002202152]
 at org.apache.commons.dbcp.BasicDataSource.getConnection( [na:Nightly-201002202152]
 at [fcrepo-server-3.4.jar:na]
 at org.fcrepo.server.utilities.SQLUtilityImpl.i_createNonExistingTables( [fcrepo-server-3.4.jar:na]
 at org.fcrepo.server.utilities.SQLUtility.createNonExistingTables( [fcrepo-server-3.4.jar:na]
 at org.fcrepo.server.utilities.rebuild.RebuildDOManager.postInitModule( [fcrepo-server-3.4.jar:na]
 at org.fcrepo.server.Server.<init>( [fcrepo-server-3.4.jar:na]
 at org.fcrepo.server.utilities.rebuild.RebuildServer.<init>( [fcrepo-server-3.4.jar:na]
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [na:1.6.0_21]
 at sun.reflect.NativeConstructorAccessorImpl.newInstance( [na:1.6.0_21]
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance( [na:1.6.0_21]
 at java.lang.reflect.Constructor.newInstance( [na:1.6.0_21]
 at org.fcrepo.server.utilities.rebuild.RebuildServer.getRebuildInstance( [fcrepo-server-3.4.jar:na]
 at org.fcrepo.server.utilities.rebuild.Rebuild.getServer( [fcrepo-server-3.4.jar:na]
 at org.fcrepo.server.utilities.rebuild.SQLRebuilder.start( [fcrepo-server-3.4.jar:na]
 at org.fcrepo.server.utilities.rebuild.Rebuild.<init>( [fcrepo-server-3.4.jar:na]
 at org.fcrepo.server.utilities.rebuild.Rebuild.main( [fcrepo-server-3.4.jar:na]
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [na:1.6.0_21]
 at sun.reflect.NativeMethodAccessorImpl.invoke( [na:1.6.0_21]
 at sun.reflect.DelegatingMethodAccessorImpl.invoke( [na:1.6.0_21]
 at java.lang.reflect.Method.invoke( [na:1.6.0_21]
 at org.fcrepo.server.utilities.rebuild.cli.CLILoader.main( [fcrepo-server-3.4-cli-loader-main.jar:na]

I don't think Tomcat is managing to connect to MySQL properly.

I'm executing the script as the tomcat6 user. I thought this might be an issue with commons-pool.jar not being in my CLASSPATH, but I've added just about every possible class path directory to the user's environment variables:


Commons-pool.jar is located at the following paths:


mysql-connector-java should also be in the CLASSPATH. I can't quite figure out what's going wrong. The script sets up the following environment:

# ps aux | grep java
tomcat6   3177 32.0  3.1 533992 64608 pts/1    Sl+  13:32   0:01 /usr/lib/jvm/java-6-sun/bin/java -server -Xmn64m -Xms256m -Xmx256m -Djava.endorsed.dirs=/var/lib/tomcat6/common/endorsed:/var/lib/tomcat6/common/lib -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl -Dcom.sun.xacml.PolicySchema=/usr/local/fedora/server/xsd/cs-xacml-schema-policy-01.xsd -Dfedora.home=/usr/local/fedora -Dfedora.web.inf.lib=/var/lib/tomcat6/webapps/fedora/WEB-INF/lib org.fcrepo.server.utilities.rebuild.cli.CLILoader org.fcrepo.server.utilities.rebuild.Rebuild

I would be grateful for any assistance.

share|improve this question
up vote 1 down vote accepted

java.lang.NoClassDefFoundError means the runtime version of the class in the classpath is not the same as that at compile time.

Note: it's not a ClassNotFound

Your problem is in fact multiple versions of the class being found.


I should have pointed out before Tomcat does not use the system CLASSPATH. The values set there should get ignored. shows anything you put into $CATALINA_HOME/lib automatically gets into the server classpath at startup time.

The jars gets picked up by the shared.loader or common.loader property of /conf/

Mine reads


So I think the problem is that you might also have a copy of this class/jar in some other locations from which Tomcat builds it's classpath.

That is anything in WEB-INF/classes and in JARs under WEB-INF/lib in your deployment are in the CLASSPATH, along with JARs that are installed in lib for Tomcat 6.

Also see for a list of other jars containing the GenericObjectPool class, and remove ones other than commons-pool.jar

Update 2

Yes, you can remove the containing folder, and the jars will no longer be in the classpath.

However, I see you have these folders in classpath, do they contain any versions of these jars? Tomcat 6 puts everything in tomcat6/lib, there is no tomcat6/common/lib which is a relic from earlier Tomcat versions. I wonder if these have incorrectly been renamed from an earlier classpath entry ?

share|improve this answer
Hi JoseK, thanks for your reply. I should clarify that Tomcat itself is running fine - it's just this rebuild shell utility which fails. When you say I should remove /usr/share/tomcat6/lib/commons-pool.jar from the classpath, can I do this by removing its containing directory (/usr/share/tomcat6/lib) from the classpath? I was assuming that there is other stuff in there that Java/Tomcat will need. – grw Oct 15 '10 at 9:34
Hi JoseK, you're so helpful! The $CATALINA_HOME/common/lib folder is actually a symlink to $CATALINA_HOME/common/classes - a legacy software installer expected to find a MySQL JDBC class there but (as you point out) it is actually where it's supposed to be in $CATALINA_HOME/common/classes. "I wonder if these have incorrectly been renamed from an earlier classpath entry ?" I've removed the /lib variant from the classpath. I think that has solved it. Thanks again. – grw Oct 15 '10 at 15:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.