引起:java.lang.ClassNotFoundException:oracle.jdbc.OracleDriver [英] Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
问题描述
我在lib文件夹中创建了一个带有ojdbc14.jar的Web应用程序。
I created a web application with ojdbc14.jar in lib folder.
然而,当我启动tomcat时出现错误:
However, when I start my tomcat I get an error:
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
虽然它存在!
当我在Eclipse中将同一个应用程序部署到我的本地tomcat时,它工作正常。
When I deploy the same application to my local tomcat in Eclipse it works fine.
然而,当我从Eclipse部署它时,我得到了这条消息,虽然jar存在!
However when I deploy it out of Eclipse I get this message, although the jar exists!
EDITED
我也从META-INF文件夹下的context.xml中引用它:
I refer to it also from the context.xml under META-INF folder:
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Transaction factory="bitronix.tm.BitronixUserTransactionObjectFactory" />
<Resource name="jdbc/testDS1" auth="Container" type="javax.sql.DataSource"
maxActive="15" maxIdle="2" maxWait="10000"
logAbandoned="true"
username="cust" password="cust"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@myserver:id:name"/>
推荐答案
您确定它存在于webapps / yourapp / WEB中吗? -INF / lib文件夹?如果在特定目录中无法看到它,则必然会抛出异常。
Are you sure it exists inside webapps/yourapp/WEB-INF/lib folder? It is bound to throw that exception if it can't be seen in that specific directory.
如何部署eclipse?您是否导出WAR文件并进行部署?验证您的WAR文件是否包含指定位置的ojdbc14.jar。
How do you deploy out of eclipse? Do you export a WAR file and deploy? Verify that your WAR file contains ojdbc14.jar in the specified location.
这篇关于引起:java.lang.ClassNotFoundException:oracle.jdbc.OracleDriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!