Maven编译和运行时错误java.lang.AbstractMethodError:Tomcat 8 Server上的oracle.jdbc.driver.T4CConnection.isValid(I)Z [英] Maven compilation and run time error java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z on Tomcat 8 Server
问题描述
我一直在将大型Java Web App转换为maven项目,但是在少数来自tomcat-dbcp jar的类中遇到了错误.我从需要使用BasicDataSource对象的任何类中获得以下错误消息:
I've been converting a large Java Web App to a maven project, but I've run into an error in a handful of classes originating from the tomcat-dbcp jar. I get the following error messages from any class that needs to use BasicDataSource objects:
javax.servlet.ServletException: java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z
java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z
现在我知道服务器上存在该jar(因为在我们的Tomcat8安装中它是默认的).因此,在Maven中,我这样声明了这种依赖关系:
Now I know this jar is present on the server (as it is default in our Tomcat8 installation). So in maven I declared this dependency as such:
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-dbcp</artifactId>
<version>8.0.26</version>
<scope>provided</scope>
</dependency>
但是我仍然看到此错误.我该怎么办才能消除此错误?
But I'm still seeing this error. What can I do to eliminate this error?
推荐答案
尽管我不知道为什么,但此错误确实消失了. pom条目仍然相同,并且仍在Tomcat 8上运行.我们确实找到了一个hacky临时修复程序:
This error did go away, though I have no idea why. The pom entry is still the same and still running on Tomcat 8. We did find a hacky temporary fix:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1</version>
<scope>system</scope>
<systemPath>${basedir}/lib/ojdbc7-12.1.0.1.jar</systemPath>
</dependency>
但是我们在某个时候恢复了,一切正常.
But we reverted back at some point and it is working fine.
这篇关于Maven编译和运行时错误java.lang.AbstractMethodError:Tomcat 8 Server上的oracle.jdbc.driver.T4CConnection.isValid(I)Z的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!