Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
798 views
in Technique[技术] by (71.8m points)

datasource - java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool DataSourceFactory

I'm investigating moving away from an Oracle connection pool and using the Tomcat connection pool. I followed the myriad of example for configuring the <Resource> in Tomcat's /conf/server.xml. I found great info here. However, when I start Tomcat, I get the following error:

javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool DataSourceFactory]

I'm using Tomcat 6.0. My <Resource> config in /conf/server.xml is:

<Resource 
    name="jdbc/myds"
    type="javax.sql.DataSource"
    auth="Container" 
    factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
    driverClassName="oracle.jdbc.OracleDriver"
    url="jdbc:oracle:thin:@10.10.10.33:1234:myds"
    user="myuname"
    password="mypasswd"
/>

I understand that Tomcat can't find the factory class, but I don't understand why? I don't see anything in the documentation about adding extra .jar files. I've looked in the distribution and can't find the golden .jar anyway.

Can anyone tell me what I am doing wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The Tomcat JDBC pool was introduced in Tomcat 7.0.19, yet you're attempting to use it in Tomcat 6.0 without any further configuration.

For Tomcat 6.0 you need to manually download and drop the latest release of the tomcat-jdbc.jar file in /lib folder of the Tomcat installation.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...