Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

On this page: http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html it describes how to set up a JNDI name for a DataSource resource. It tells you that Tomcat's standard data source factory is org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory, but I've searched every single jar file on my system after installing Tomcat on Fedora 17 and I cannot find one that contains this class.

Where is it?

share|improve this question
    
Might be in a not installed package. Or the java class' package might be renamed for some reason by the distro. Does dbcp actually work? –  akostadinov Jun 1 '12 at 20:07
    
@akostadinov: I'm asking because I'm having a lot of difficulty setting up a JNDI mapping for a data source and I'm getting an error about missing that class. –  Omnifarious Jun 1 '12 at 21:34
    
what version of tomcat do you use? Is this the one packaged in fedora (tomcat6) and do you install it with yum? Maybe you want to try org/apache/commons/dbcp/BasicDataSourceFactory which is provided by apache-commons-dbcp.jar. Perhaps you can file a fedora bugzilla so they change the default. –  akostadinov Jun 14 '12 at 10:13

1 Answer 1

up vote 3 down vote accepted

In a standard Tomcat install downloaded from the ASF, that class can be found in tomcat-dbcp.jar. If that JAR is not shipped in Fedora then the Fedora packaging is broken. The Tomcat project has good reasons for shipping the package renamed Commons DBCP rather than the original.

As a work-around, and as long as no web application deployed on Tomcat uses Commons DBCP, you can add the Commons DBCP jar to Tomcat's lib directory and adjust your factory accordingly. Alternatively, you could just grab a copy of Tomcat direct from the ASF.

share|improve this answer
    
The Fedora 17 tomcat-lib package puts apache-commons-dbcp.jar and commons-dbcp.jar in the /usr/share/java/tomcat directory with all the other jar files. I think I'll just wait until this bug is fixed. You helped me find it, so thank you: bugzilla.redhat.com/show_bug.cgi?id=819087 –  Omnifarious Jun 1 '12 at 22:13
    
Actually, this is the standard Java stupidity. Yes, we can't possibly fix our program to work with version X of a library, so we'll just ship our own copy of version Y with all the classes renamed! sigh –  Omnifarious Mar 4 '13 at 7:27
    
The package is renamed in Tomcat for very good reasons - namely to avoid conflicts between Tomcat's use of a particular version of Commons DBCP to provide connection pooling and a web application that wishes to use a different version. Without the renaming the two versions of DBCP would conflict causing the web application to fail. The renaming happens automatically as part of the Tomcat build so a) the code is functionally identical to the Commons DBCP version on which it is based and b) it is trivial to update as and when there is a Commons DBCP release. –  Mark Thomas Mar 5 '13 at 15:23
    
I've noticed that practically every Java application includes it's own renamed versions of every single library it uses to avoid conflicting with other versions out there. It's what I've come to expect whenever I work on a Java thing. :-/ –  Omnifarious Mar 5 '13 at 15:32

Your Answer

 
discard

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.