ojdbc8 jar未加载到Tomcat8中

时间:2018-10-07 03:52:20

标签: java jdbc tomcat8 ojdbc

我们正在为应用程序使用Tomcat8(准确地说是Tomcat 8.0.30)和Java8。与ojdbc7数据库驱动程序以及所有其他jar一起提供的示例ucp.jar和ons.jar等与Oracle数据库11g。如果我在Java应用程序中(即在Tomcat中)启用了“ verbose:class”,则会显示所有从ojdbc.jar和ucp.jar文件加载的类。

现在,我们已将数据库升级到12c,因此我们将数据库驱动程序升级到12.2 ojdbc8.jar。我替换了所有jar(ojdbc,ucp,ons),但是Tomcat抱怨并给出错误NoClassDefFound异常。当我使用相同的详细'verbose:class'选项时,我看不到从ojdbc8.jar加载任何类。 (来自ucp.jar的类不会被加载)。然后jar文件位于$ CATALINA_HOME / lib位置。但是不确定为什么不加载ojdbc8.jar。

感谢您提供帮助以解决此问题。

这是有关NoClassFoundException的异常

SEVERE: The required Server component failed to start so Tomcat is 
unable to start.
org.apache.catalina.LifecycleException: Failed to start component 
[StandardServer[43004]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.startup.Catalina.start(Catalina.java:625)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
Caused by: java.lang.ExceptionInInitializerError
at oracle.ucp.jdbc.PoolDataSourceImpl.allowSetter(PoolDataSourceImpl.java)
at oracle.ucp.jdbc.PoolDataSourceImpl.setUser(PoolDataSourceImpl.java:2089)
at oracle.ucp.jdbc.PoolDataSourceImpl.getObjectInstance(PoolDataSourceImpl.java:3945)
at com.intralinks.tomcat.ucp.UcpDataSourceFactory.getObjectInstance(UcpDataSourceFactory.java:68)
at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:94)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
at org.apache.naming.NamingContext.lookup(NamingContext.java:841)
at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:117)
at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:34)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:138)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:145)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:110)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:82)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:347)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:762)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: oracle/jdbc/logging/annotations/Supports
at oracle.jdbc.logging.runtime.Features.<init>(Features.java:45)
at oracle.jdbc.logging.runtime.TraceControllerImpl.<clinit>(TraceControllerImpl.java:32)
... 28 more
Caused by: java.lang.ClassNotFoundException: oracle/jdbc/logging/annotations/Supports
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at oracle.jdbc.logging.runtime.Features.<init>(Features.java:33)
... 29 more

1 个答案:

答案 0 :(得分:0)

我想回答这个问题。似乎ojdbc7.jar在tomcat下被硬编码。因为当我将ojdbc8.jar重命名为ojdbc7.jar时它可以工作。因此,必须在某处进行硬编码。我还没有找到,但是我会的。它不是catalina.properties。