I'm running FC6 with Tomcat 5.5.17 (standard rpm packages from the FC6 distribution).
The main problem I'm having is getting my database connection pool setup.I'm getting a severe error that seems to be the source, but not sure what the easy fix is. Obviously the
java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory
means Tomcat can't find a class it needs, but as I'm running all rpms from FC6 I assumed everything would be 'plug and play'. Does anyone have some suggestions for fixing this quick?
Thank you in advance.
Below is the server.xml...
<?xml version="1.0" encoding="UTF-8"?> <Server> <Listener className="org.apache.catalina.core.AprLifecycleListener"/> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/> <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/> <GlobalNamingResources> <Environment name="simpleValue" type="java.lang.Integer" value="30"/> <Resource name="jdbc/MSIWebDB" type="javax.sql.DataSource" maxWait="5000" password="boo" url="jdbc:mysql://msisql.inside.msi:3306/msi_intranet" maxActive="4" driverClassName="com.mysql.jdbc.Driver" username="msi_intranet" maxIdle="2"/> <Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/> </GlobalNamingResources> <Service name="Catalina"> <Connector port="8080" redirectPort="8443" maxSpareThreads="75" maxThreads="150" connectionTimeout="20000" minSpareThreads="25"> </Connector> <Connector port="8009" redirectPort="8443" protocol="AJP/1.3"> </Connector> <Engine defaultHost="localhost" name="Catalina"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/> <Host appBase="webapps" name="localhost"> </Host> </Engine> </Service> </Server>
Below are the server logs from startup...
10-May-07 4:06:51 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/gcj-4.1.1 10-May-07 4:06:51 PM org.apache.coyote.http11.Http11BaseProtocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 10-May-07 4:06:51 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 837 ms 10-May-07 4:06:51 PM org.apache.catalina.core.NamingContextListener addResource WARNING: Failed to register in JMX: javax.naming.NamingException: Could not create resource factory instance 10-May-07 4:06:51 PM org.apache.catalina.mbeans.GlobalResourcesLifecycleListener createMBeans SEVERE: Exception processing Global JNDI Resources javax.naming.NamingException: Could not create resource factory instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(naming-factory-5.5.17.jar.so) at javax.naming.spi.NamingManager.getObjectInstance(libgcj.so.7rh) at org.apache.naming.NamingContext.lookup(naming-factory-5.5.17.jar.so) at org.apache.naming.NamingContext.lookup(naming-factory-5.5.17.jar.so) at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(naming-resources-5.5.17.jar.so) at org.apache.naming.NamingContextBindingsEnumeration.next(naming-resources-5.5.17.jar.so) at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(catalina-5.5.17.jar.so7ygbw0.so) at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(catalina-5.5.17.jar.so7ygbw0.so) at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(catalina-5.5.17.jar.so7ygbw0.so) at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(catalina-5.5.17.jar.so7ygbw0.so) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(catalina-5.5.17.jar.so7ygbw0.so) at org.apache.catalina.core.StandardServer.start(catalina-5.5.17.jar.so7ygbw0.so) at org.apache.catalina.startup.Catalina.start(catalina-5.5.17.jar.so7ygbw0.so) at java.lang.reflect.Method.invoke(libgcj.so.7rh) at org.apache.catalina.startup.Bootstrap.start(bootstrap.jar.so) at org.apache.catalina.startup.Bootstrap.main(bootstrap.jar.so) Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory not found in org.apache.catalina.loader.StandardClassLoader{urls=[file:/var/lib/tomcat5/common/classes/,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-en.jar,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-fr.jar,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-es.jar,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-ja.jar,file:/usr/share/java/xml-commons-apis-1.3.02.jar,file:/usr/share/java/xerces-j2-2.7.1.jar,file:/usr/share/java/jakarta-commons-collections-3.1.jar,file:/usr/share/java/libgcj-4.1.1.jar,file:/usr/share/java/jakarta-commons-el-1.0.jar,file:/usr/share/java/tomcat5-jsp-2.0-api-5.5.17.jar,file:/usr/share/java/libgcj-4.1.1.jar,file:/usr/share/java/classpathx-jaf-1.0.jar,file:/usr/share/java/ant-1.6.5.jar,file:/var/lib/tomcat5/common/lib/mysql-connector-java-5.0.5-bin.jar,file:/usr/share/java/jasper5-runtime-5.5.17.jar,file:/usr/share/java/tomcat5/naming-resources-5.5.17.jar,file:/usr/share/java/geronimo/spec-jta-1.0.1B-rc2.jar,file:/usr/share/java/tomcat5-servlet-2.4-api-5.5.17.jar,file:/usr/share/java/jakarta-commons-pool-1.3.jar,file:/usr/share/java/classpathx-mail-1.3.1-monolithic-1.1.1.jar,file:/usr/share/java/jasper5-compiler-5.5.17.jar,file:/usr/share/java/jakarta-commons-logging-api-1.0.4.jar,file:/usr/share/java/jakarta-commons-dbcp-1.2.1.jar,file:/usr/share/eclipse/plugins/org.eclipse.jdt.core_3.2.3.v_686_R32x.jar,file:/usr/share/java/mx4j/mx4j-3.0.1.jar,file:/usr/share/java/tomcat5/naming-factory-5.5.17.jar], parent=gnu.gcj.runtime.SystemClassLoader{urls=[file:/usr/lib/jvm/java/lib/tools.jar,file:/usr/share/tomcat5/bin/bootstrap.jar,file:/usr/share/tomcat5/bin/commons-logging-api.jar,file:/usr/share/java/mx4j/mx4j-impl.jar,file:/usr/share/java/mx4j/mx4j-jmx.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}} at java.net.URLClassLoader.findClass(libgcj.so.7rh) at java.lang.ClassLoader.loadClass(libgcj.so.7rh) at java.lang.ClassLoader.loadClass(libgcj.so.7rh) at java.lang.Class.forName(libgcj.so.7rh) at java.lang.Class.forName(libgcj.so.7rh) at org.apache.naming.factory.ResourceFactory.getObjectInstance(naming-factory-5.5.17.jar.so) ...15 more 10-May-07 4:06:51 PM org.apache.catalina.core.StandardService start INFO: Starting service Catalina 10-May-07 4:06:51 PM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/5.5.17 10-May-07 4:06:51 PM org.apache.catalina.core.StandardHost start INFO: XML validation disabled 10-May-07 4:06:54 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml' 10-May-07 4:06:54 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validator/validation.xml' 10-May-07 4:06:56 PM org.apache.catalina.core.ApplicationContext log INFO: action: []: Verifying ModuleConfig for this module 10-May-07 4:06:56 PM org.apache.catalina.core.ApplicationContext log INFO: action: []: Verification of ModuleConfig has been completed 10-May-07 4:06:56 PM org.apache.struts.webapp.example.memory.MemoryDatabasePlugIn init INFO: Initializing memory database plug in from '/WEB-INF/database.xml' 10-May-07 4:06:56 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml' 10-May-07 4:06:56 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validation.xml' 10-May-07 4:06:58 PM org.apache.struts.tiles.TilesPlugin initDefinitionsFactory INFO: Tiles definition factory loaded for module ''. 10-May-07 4:06:58 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml' 10-May-07 4:06:58 PM org.apache.struts.validator.ValidatorPlugIn initResources
INFO: Loading validation rules file from '/WEB-INF/validation.xml'
On Thu, 2007-05-10 at 16:23 -0700, Tim Alberts wrote:
I'm running FC6 with Tomcat 5.5.17 (standard rpm packages from the FC6 distribution).
The main problem I'm having is getting my database connection pool setup.I'm getting a severe error that seems to be the source, but not sure what the easy fix is. Obviously the
java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory
means Tomcat can't find a class it needs, but as I'm running all rpms from FC6 I assumed everything would be 'plug and play'. Does anyone have some suggestions for fixing this quick?
This is because there were some jars missing from the corresponding version of the jpackage rpm
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=238192
Until the package is updated the workaround I'm using is to manually add naming-factory-dbcp.jar to /var/lib/tomcat5/common/lib/
-Aaron
On Thu, 2007-05-10 at 17:36 -0600, Aaron Luchko wrote:
On Thu, 2007-05-10 at 16:23 -0700, Tim Alberts wrote:
java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory
means Tomcat can't find a class it needs, but as I'm running all rpms from FC6 I assumed everything would be 'plug and play'. Does anyone have some suggestions for fixing this quick?
This is because there were some jars missing from the corresponding version of the jpackage rpm
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=238192
Until the package is updated the workaround I'm using is to manually add naming-factory-dbcp.jar to /var/lib/tomcat5/common/lib/
The real issue is that upstream tomcat5 build creates the naming-factory-dbcp.jar and others by extracting classes from commons-dbcp, collections, etc. and sticking them under the org.apache.tomcat.x package (I personally dont like it but some claim they prefer this since they can include newer/older j-c-* jars in their webapps and prevent classloading issues) . Until recently, JPackage has been sym-linking to j-c-dbcp.jar etc. produced by the relevant jakarta-commons-* rpm directly without changing the packages. It is only recently that these jakarta-commons-* packages have been modified to produce a -tomcat5 package that have these renamed packages which tomcat5 sym-links to.
For the moment, a workaround I would go with is to add a Resource tag in your /etc/tomcat5/server.xml file nexted under the GlobalNamingResources tag with factory="org.apache.commons.dbcp.BasicDataSourceFactory" attribute or doing the same thing in your web-app's context.xml nested inside the the Context tag... You can refer to http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html for reference.
However, I do think there are several benefits to going to 5.5.23 for tomcat5, I just havent evaluated all the changes necessary in Fedora 6/7. I will update bz# 238192 when I am ready. Vivek
java-devel@lists.fedoraproject.org