You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Gregor Schneider <rc...@googlemail.com> on 2009/03/03 20:38:02 UTC

ClassNotFoundException org.apache.commons.dbcp.Ba sicDataSourceFactory

Hi guys,

now I do have a question:

Preface:

Using CATALINA_BASE:   /usr/local/tomcat-6.0.18
Using CATALINA_HOME:   /usr/local/tomcat-6.0.18
Using CATALINA_TMPDIR: /usr/local/tomcat-6.0.18/temp
Using JRE_HOME:       /usr
Server version: Apache Tomcat/6.0.18
Server built:   Jul 22 2008 02:00:36
Server number:  6.0.18.0
OS Name:        Linux
OS Version:     2.6.24-etchnhalf.1-amd64
Architecture:   amd64
JVM Version:    1.6.0_10-b33
JVM Vendor:     Sun Microsystems Inc.

I'm using a vanilla dowenload from the Apache website - no Debian'ed Tomcat.

In my server.xml I'vespecified a JDBC-realm for AAA:

<Realm  className="org.apache.catalina.realm.JDBCRealm"
              connectionPassword="somePass"
              userCredCol="someCol"
              userTable="someTableName"
              driverName="com.mysql.jdbc.Driver"
              connectionURL="jdbc:mysql://localhost:3306/someDB"
              connectionName="someDBUser"
              digest="MD5"
              userNameCol="anotherCol"
              userRoleTable="anotherColName"
              roleNameCol="someRoleName" />

The servlet performing AAA is loaded, however, using a
datasource-specification which is not available any more.
This is due to the fact that I switched to Tomcat's AAA-mechanism and
actually don't need the servlet any more - however, it still get's
loaded and I was expecting an error, but not a CNF-Ecxeption:

2009-03-02 22:26:17,489 ERROR                   [catalina-exec-1]:
 org.apache.jsp.login_005fwebdemo_005fde._403_jsp:Exception caught
during jdpinit
javax.servlet.ServletException: javax.naming.NamingException: Could
not load resource factory class [Root exception is
java.lang.ClassNotFoundException: org.a
pache.commons.dbcp.BasicDataSourceFactory]
        at com.cr.web.dbutil.DBconnect.init(DBconnect.java:66)
        at com.cr.web.sso.DBManager.init(DBManager.java:223)
        at com.cr.web.sso.DBManager.<init>(DBManager.java:26)
        at org.apache.jsp.login_005fwebdemo_005fde._403_jsp.clearSessionTable(_403_jsp.java:61)
        at org.apache.jsp.login_005fwebdemo_005fde._403_jsp._jspService(_403_jsp.java:160)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
        at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:394)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857)
        at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)
        at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:1947)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)

Now when I look into the archive ${CATALINA_HOME}/lib/tomcat-dbcp,jar,
I see the following:

compass@compass:/usr/local/tomcat/lib$ jar -tvf tomcat-dbcp.jar |grep
-i basicdatasourcefactory
7402 Tue Jul 22 02:00:18 CEST 2008
org/apache/tomcat/dbcp/dbcp/BasicDataSourceFactory.class

Hm - I'm not using BasicDataSourceFactory, so I figure it comes from
somewhere within Tomcat (don't have the sources here right now, so
can't look it up).

has there been a renaming of some dbcp-packages within Tomcat? And if
so - is it possible that some imports within Tomcat have been missed
being updated to the new package-names?

Puzzled...

Gregor
-- 
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: ClassNotFoundException org.apache.commons.dbcp.BasicDataSourceFactory

Posted by Gregor Schneider <rc...@googlemail.com>.
Chuck,

glad you're still my heroe ;)

However, I see clearly now what went wrong:

In Tomcat 4.1 there's a description about datasources:

http://tomcat.apache.org/tomcat-4.1-doc/config/globalresources.html

In there, there's a link to a JNDI-how-to:
http://tomcat.apache.org/tomcat-4.1-doc/jndi-resources-howto.html

Sometime, we miograted from 4.1 to 5.5.

In 5.5, there's also a description about datasoources:

http://tomcat.apache.org/tomcat-5.5-doc/config/globalresources.html

There's also a link to a JNDI-howto pointing to
http://tomcat.apache.org/tomcat-5.5-doc/jndi-resource-howto.html#Generic%20JavaBean%20Resources
(not the first link, but the last one at the end of the page) giving a
HTTP404.

I guess I got that 404, tried it the old fashioned way (which worked
since the pakacges had been renamed), and BINGO!

Anyhow, issue's settled now, thanks to all for clearification!

Cheers

Gregor
-- 
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: ClassNotFoundException org.apache.commons.dbcp.BasicDataSourceFactory

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Gregor Schneider [mailto:rc46fi@googlemail.com]
> Subject: Re: ClassNotFoundException
> org.apache.commons.dbcp.BasicDataSourceFactory
>
> In both directories ${CATALINA_HOME}/server/lib and
> ${CATALINA_HOME}/common/lib I do not find a file tomcat-dbcp.jar.

To protect the guilty (I suppose), it's called naming-factory-dbcp.jar in common/lib for the 5.5 levels.  Look inside it - you'll find all the DBCP classes.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: ClassNotFoundException org.apache.commons.dbcp.BasicDataSourceFactory

Posted by Len Popp <le...@gmail.com>.
On Tue, Mar 3, 2009 at 16:53, Gregor Schneider <rc...@googlemail.com> wrote:
> I just looked it up in our old server (vanilla download from
> tomcat.apache.org, more info:
>
> Using CATALINA_BASE:   /home/tomcat/local/tomcat55/
> Using CATALINA_HOME:   /home/tomcat/local/tomcat55/
> Using CATALINA_TMPDIR: /home/tomcat/local/tomcat55//temp
> Using JRE_HOME:       /home/tomcat/local/jdk15/
> Server version: Apache Tomcat/5.5.20
> Server built:   Sep 12 2006 10:09:20
> Server number:  5.5.20.0
> OS Name:        Linux
> OS Version:     2.6.18-3-amd64
> Architecture:   amd64
> JVM Version:    1.5.0_10-b03
> JVM Vendor:     Sun Microsystems Inc.
>
> In the directory ${CATALINA_HOME}/common/lib I find the following
> files (among others):
>
> commons-collections-3.2.jar
> commons-dbcp-1.2.1.jar
> commons-pool-1.3.jar
> naming-factory.jar

That's not a "vanilla download". You've added some chocolate sprinkles
to common/lib. :-)

As Chuck pointed out, the DBCP classes are in naming-factory-dbcp.jar
- but note that the package names were changed to avoid conflicting
with commons-dbcp.jar. Some webapps include commons-dbcp.jar so they
can run on non-Tomcat containers that don't include Commons DBCP by
default.
-- 
Len

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: ClassNotFoundException org.apache.commons.dbcp.BasicDataSourceFactory

Posted by Gregor Schneider <rc...@googlemail.com>.
Hi Chuck,


On Tue, Mar 3, 2009 at 10:08 PM, Caldarale, Charles R
<Ch...@unisys.com> wrote:
>
> The commons-dbcp jar has been renamed and distributed as part of Tomcat as far back as I can remember, at least since early 5.0 levels.  There was certainly no change between 5.5 and 6.0 for this.

Chuck, you're one of my heroes in this list, however, I have to disagree:

I just looked it up in our old server (vanilla download from
tomcat.apache.org, more info:

Using CATALINA_BASE:   /home/tomcat/local/tomcat55/
Using CATALINA_HOME:   /home/tomcat/local/tomcat55/
Using CATALINA_TMPDIR: /home/tomcat/local/tomcat55//temp
Using JRE_HOME:       /home/tomcat/local/jdk15/
Server version: Apache Tomcat/5.5.20
Server built:   Sep 12 2006 10:09:20
Server number:  5.5.20.0
OS Name:        Linux
OS Version:     2.6.18-3-amd64
Architecture:   amd64
JVM Version:    1.5.0_10-b03
JVM Vendor:     Sun Microsystems Inc.

In the directory ${CATALINA_HOME}/common/lib I find the following
files (among others):

commons-collections-3.2.jar
commons-dbcp-1.2.1.jar
commons-pool-1.3.jar
naming-factory.jar

tomcat@www1:~/local/tomcat55/common/lib$ jar -tvf
commons-dbcp-1.2.1.jar | grep -i basicdata
14127 Sat Jun 12 15:41:30 CEST 2004
org/apache/commons/dbcp/BasicDataSource.class
7387 Sat Jun 12 15:41:30 CEST 2004
org/apache/commons/dbcp/BasicDataSourceFactory.class

In both directories ${CATALINA_HOME}/server/lib and
${CATALINA_HOME}/common/lib I do not find a file tomcat-dbcp.jar.

So I guess you have to borrow some memory from your iPhone ;)

Cheers

Gregor
-- 
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: ClassNotFoundException org.apache.commons.dbcp.BasicDataSourceFactory

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Gregor Schneider [mailto:rc46fi@googlemail.com]
> Subject: Re: ClassNotFoundException
> org.apache.commons.dbcp.BasicDataSourceFactory
>
> I've ported the Servlet from Tomcat 5.5 to Tomcat 6, and if I'm not
> mistaken, there had been some re-naming and re-packaging of
> commons-dbcp within Tomcat so that dbcp now is an integral part of
> Tomcat and needs not to be added to Tomcat after installation any
> more.

The commons-dbcp jar has been renamed and distributed as part of Tomcat as far back as I can remember, at least since early 5.0 levels.  There was certainly no change between 5.5 and 6.0 for this.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: ClassNotFoundException org.apache.commons.dbcp.Ba sicDataSourceFactory

Posted by Gregor Schneider <rc...@googlemail.com>.
Hi guys,

I found the solution - my fault:

If anyone's interested:

within the context.xml of the servlet I had the following realm-specification.

  <Resource
    auth="Container"
    description="DB Connection for SSO"
    name="jdbc/SSODS"
    type="javax.sql.DataSource"
    factory="org.apache.commons.dbcp.BasicDataSourceFactory"

I've ported the Servlet from Tomcat 5.5 to Tomcat 6, and if I'm not
mistaken, there had been some re-naming and re-packaging of
commons-dbcp within Tomcat so that dbcp now is an integral part of
Tomcat and needs not to be added to Tomcat after installation any
more.

Rgds

Gregor
-- 
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org