Bug 750549

Summary: Introduced dependency on tomcat-dbcp
Product: Red Hat Enterprise Linux 6 Reporter: David G. Mackay <mackay_d>
Component: tomcat6Assignee: David Knox <dknox>
Status: CLOSED CURRENTRELEASE QA Contact: tomcat-qe
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.0CC: jclere, jdennis, jpechane
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-01-26 19:16:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description David G. Mackay 2011-11-01 14:53:53 UTC
Description of problem:
tomcat6-6.0.24-33 requires that tomcat-dbcp.jar be present in /usr/share/tomcat6/lib in order to use dbcp rather that just using dbcp from the jakarta commons library.  This was not present in tomcat6-6.0.24-24

Version-Release number of selected component (if applicable):
tomcat6-6.0.24-33.el6

How reproducible:
Always

Steps to Reproduce:
1. Fire up a web app that uses dbcp
2.
3.
  
Actual results:
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

javax.servlet.ServletException: javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
	org.apache.jsp.listDVDs_jsp._jspService(listDVDs_jsp.java:103)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
	org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:118)
	javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
	org.apache.naming.NamingContext.lookup(NamingContext.java:793)
	org.apache.naming.NamingContext.lookup(NamingContext.java:140)
	org.apache.naming.NamingContext.lookup(NamingContext.java:781)
	org.apache.naming.NamingContext.lookup(NamingContext.java:140)
	org.apache.naming.NamingContext.lookup(NamingContext.java:781)
	org.apache.naming.NamingContext.lookup(NamingContext.java:140)
	org.apache.naming.NamingContext.lookup(NamingContext.java:781)
	org.apache.naming.NamingContext.lookup(NamingContext.java:153)
	org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
	javax.naming.InitialContext.lookup(InitialContext.java:409)
	Beans.DbBean.<init>(DbBean.java:21)
	org.apache.jsp.listDVDs_jsp._jspService(listDVDs_jsp.java:64)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory
	java.net.URLClassLoader$1.run(URLClassLoader.java:217)
	java.security.AccessController.doPrivileged(Native Method)
	java.net.URLClassLoader.findClass(URLClassLoader.java:205)
	java.lang.ClassLoader.loadClass(ClassLoader.java:321)
	java.lang.ClassLoader.loadClass(ClassLoader.java:266)
	java.lang.Class.forName0(Native Method)
	java.lang.Class.forName(Class.java:186)
	org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:115)
	javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
	org.apache.naming.NamingContext.lookup(NamingContext.java:793)
	org.apache.naming.NamingContext.lookup(NamingContext.java:140)
	org.apache.naming.NamingContext.lookup(NamingContext.java:781)
	org.apache.naming.NamingContext.lookup(NamingContext.java:140)
	org.apache.naming.NamingContext.lookup(NamingContext.java:781)
	org.apache.naming.NamingContext.lookup(NamingContext.java:140)
	org.apache.naming.NamingContext.lookup(NamingContext.java:781)
	org.apache.naming.NamingContext.lookup(NamingContext.java:153)
	org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
	javax.naming.InitialContext.lookup(InitialContext.java:409)
	Beans.DbBean.<init>(DbBean.java:21)
	org.apache.jsp.listDVDs_jsp._jspService(listDVDs_jsp.java:64)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)



Expected results:
successfully completed transaction

Additional info:
Downloading and installing tomcat-dbcp.jar in /usr/share/tomcat6/lib fixed the problem

Comment 2 RHEL Program Management 2011-11-01 15:29:03 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 3 David G. Mackay 2011-11-08 14:15:09 UTC
The reason that I turned this in as a bug is that the dependency on tomcat-dbcp should be removed, in my opinion.  Installing tomcat-dbcp is a temporary fix.  If you're not going to include tomcat-dbcp.jar, then this IS a bug.

Comment 4 David Knox 2012-01-26 19:16:36 UTC
This is related to: rhbz 217630, 217141, & 669969. It is a configuration issue.

tomcat-jdbc.jar is a conglomeration of commons-collections,
commons-dbcp, and commons-pool.The tomcat build changes one bit of code to prohibit the use of collections::UnmodifiableList. It changes the package
name to o.a.t.dbcp.dbcp.*, compiles, and rejars into tomcat-jdbc. RHEL packaging for tomcat5 and tomcat6, as well as Fedora packaging, do not fire that target. The org.apache.commons.dbcp.BasicDataSourceFactory (from commons-dbcp) is the same class as org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory (from tomcat-dbcp-dbcp).The dependencies (the Requires and BuildRequires) on commons-xxx-tomcat5 do not exist in the spec file. Nevertheless, Tomcat internals assume org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory as the default if the j2ee configuration of the DataSource.Factory does not exist.

Using the javax.sql.DataSource.Factory j2ee property to define the
BasicDataSourceFactory should fix the problem permenently. You don't need to use the factory attribute in your web.xml.

The configuration was introduced in tomcat6.conf for tomcat6-6.0.24-29.el6 and tomcat6-6.0.24-34.el6_1. /etc/tomcat6/tomcat6.conf already contains:
JAVA_OPTS="${JAVA_OPTS} -Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory"

Since the current release contains the correct configuration, I'm closing this with CURRENTRELEASE