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

守給你的承諾、 提交于 2019-11-30 06:34:01

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/5723830/java-lang-classnotfoundexception-org-apache-tomcat-jdbc-pool-datasourcefactory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!