Bug 669969 - tomcat-jdbc is missed in tomcat6 package, therefore datasource configration is broken
Summary: tomcat-jdbc is missed in tomcat6 package, therefore datasource configration i...
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: tomcat6   
(Show other bugs)
Version: 14
Hardware: Unspecified
OS: Linux
low
medium
Target Milestone: ---
Assignee: David Knox
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords: Reopened
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-16 11:21 UTC by rssh
Modified: 2015-11-02 00:16 UTC (History)
7 users (show)

Fixed In Version: tomcat6-6.0.32-8.fc15
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-10-19 04:35:28 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description rssh 2011-01-16 11:21:47 UTC
Description of problem:

tomcat6-jdbc is not included in tomcat distribution, so programs which use db pools does not works.


How reproducible:

Try to configure JDBC data-source according to 
    http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html

Actual results:

error during staet:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ifsDataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
	... 62 more
Caused by: javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
	at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:118)
	at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
	at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
	at javax.naming.InitialContext.lookup(InitialContext.java:409)
	at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
	at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
	at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
	at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
	at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
	at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
	at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201)
	at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
	... 69 more
Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory
	at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:186)
	at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:114)
	... 90 more
Jan 16, 2011 1:06:05 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Jan 16, 2011 1:06:05 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/ifs] startup failed due to previous errors
Jan 16, 2011 1:06:05 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Jan 16, 2011 1:06:05 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
 


Expected results:


Additional info:

  Look's like tomcat-jdbc package is missing from distribution.
When get tomcat-jdbc from other tomcat distribution - all work.

Comment 1 David Knox 2011-01-17 17:15:11 UTC
This is https://bugzilla.redhat.com/show_bug.cgi?id=217630.

Could you try the following configuration change?

changes added into config files:
Config file etc/sysconfig/tomcat5

@@ -26,6 +26,11 @@
 # for ExtensionValidator to be functional. 
 JAVA_OPTS="$JAVA_OPTS
-Dcatalina.ext.dirs=$CATALINA_HOME/shared/lib:$CATALINA_HOME/common/lib"

+# rhbz 217630, 217141 - naming-factory-dbcp.jar missing
+# the real problem is a cnfe that is avoided by configuring
+# the -Djavax.sql.DataSource.Factory
+JAVA_OPTS="${JAVA_OPTS}
-Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory"
+
 # What user should run tomcat
 TOMCAT_USER="tomcat"


The tomcat-jdbc.jar is a (iirc) conglomeration of commons-collections, commons-dbcp, and commons-pool. The tomcat build combines these jars and prohibits the use of (again, iirc) the UnmodifiableList. It changes the package name, compiles and rejars into tomcat-jdbc. RHEL packaging for tomcat5 and tomcat6, as well as Fedora packaging for tomcat6 does not fire that particular target. Nevertheless,Tomcat internals assume (hardcoded as a last resort) org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory as a default. 

Using the javax.sql.DataSource.Factory j2ee property one can define the BasicDataSourceFactory for the javax.sql.DataSource.Factory. Given the process previously described: i.e., of expanding the jars, changing package names, and combining them into a new jar, the org.apache.commons.dbcp.BasicDataSourceFactory (from commons-dbcp) is essentially the same class as org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory (from tomcat-dbcp-dbcp).

I am making the changes to the tomcat6.conf template for the fedora builds today.

The changes have been tested in RHEL builds. Please feel free to follow up if the configuration shown above doesn't allow you to progress. 

cheers,
--dave

Comment 2 Orion Poplawski 2011-02-10 22:19:35 UTC
Changing the obvious tomcat5->tomcat6, adding the option to JAVA_OPTS works for me.

Comment 3 Cédric OLIVIER 2011-06-27 16:08:45 UTC
same for me, adding JAVA_OPTS option works fine for me (tomcat6).

Comment 4 Cédric OLIVIER 2011-06-28 19:05:16 UTC
Why have you closed this bug ?

Why don't add 
JAVA_OPTS="${JAVA_OPTS} -Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory"

in /etc/sysconfig/tomcat6 ?

Comment 5 Fedora Update System 2011-07-05 17:51:26 UTC
tomcat6-6.0.32-4.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/tomcat6-6.0.32-4.fc15

Comment 6 Fedora Update System 2011-07-06 21:35:15 UTC
Package tomcat6-6.0.32-4.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing tomcat6-6.0.32-4.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/tomcat6-6.0.32-4.fc15
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2011-09-27 22:25:05 UTC
tomcat6-6.0.32-8.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/tomcat6-6.0.32-8.fc15

Comment 8 Fedora Update System 2011-09-27 22:26:11 UTC
tomcat6-6.0.32-17.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/tomcat6-6.0.32-17.fc16

Comment 9 Fedora Update System 2011-10-19 04:35:28 UTC
tomcat6-6.0.32-17.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2011-10-20 09:57:35 UTC
tomcat6-6.0.32-8.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.