java.lang.ClassNotFoundException:org.apache.tomcat.jdbc.pool DataSourceFactory [英] java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool DataSourceFactory
问题描述
我正在研究如何脱离Oracle连接池并使用Tomcat连接池。我遵循了无数的示例,在Tomcat的 /conf/server.xml
中配置< Resource>
。我在此处找到了不错的信息。但是,当我启动Tomcat时,出现以下错误:
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:无法加载资源工厂类[根异常是java.lang.ClassNotFoundException:org.apache.tomcat.jdbc.pool DataSourceFactory]
javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool DataSourceFactory]
我正在使用Tomcat 6.0。我在 /conf/server.xml
中的< Resource>
配置是:
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"
/>
我知道Tomcat找不到工厂类,但我不明白为什么?我在文档中看不到任何有关添加额外的 .jar
文件的信息。我已经查看了发行版,却找不到金色的 .jar
。
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?
推荐答案
Tomcat JDBC池是在Tomcat 7.0.19中引入,但是您试图在Tomcat 6.0中使用它而无需进行任何进一步的配置。
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.
对于Tomcat 6.0,您需要手动下载并将最新版本的 tomcat-jdbc.jar
文件拖放到Tomcat安装的 / lib
文件夹中。
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.
这篇关于java.lang.ClassNotFoundException:org.apache.tomcat.jdbc.pool DataSourceFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!