[英]Ojdbc8 jars upgrade to 21.1.0.0 throws Nosuchmethod exception UCPservletContextListener init
Ojdbc8, ons, ucp jars are upgraded to 21.1.0.0 version. ojdbc8、ons、ucp jars升级到21.1.0.0版本。 When trying to start the app on tomcat server, it's throwing Nosuchmethod exception.尝试在 tomcat 服务器上启动应用程序时,它抛出 Nosuchmethod 异常。 Logged in the Tomcat's localhost.log file.登录Tomcat的localhost.log文件。 Application tries to establish DB connection during startup itself.应用程序尝试在启动期间建立数据库连接。
01-Jun-2021 15:59:56.641 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log 3 Spring WebApplication Initializers detected on classpath 01-Jun-2021 16:00:05.365 INFO localhost-startStop-1 org.apache.catalina.core.ApplicationContext.log Initializing Spring embedded WebApplicationContext 01-Jun-2021 16:00:19.397 SEVERE localhost-startStop-1 org.apache.catalina.core.StandardContext.listenerStart Error configuring application listener of class [oracle.ucp.jdbc.UCPServletContextListener] java.lang.NoSuchMethodException: oracle.ucp.jdbc.UCPServletContextListener.init at java.lang.class.getConstructor(Unknown Source) 01-Jun-2021 15:59:56.641 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log 3 Spring WebApplication Initializers 在 classpath 上检测到 01-Jun-2021 16:00:05.365 INFO localhost-startStop -1 org.apache.catalina.core.ApplicationContext.log 初始化 Spring 嵌入式 WebApplicationContext 01-Jun-2021 16:00:19.397 SEVERE localhost-startStop-1 org.apache.catalina.core.StandardContext.listenerStart 配置类的应用程序侦听器时出错[oracle.ucp.jdbc.UCPServletContextListener] java.lang.NoSuchMethodException: oracle.ucp.jdbc.UCPServletContextListener.init at java.lang.class.getConstructor(Unknown Source)
This is a known issue with ucp.jar in 21.1.这是 21.1 中 ucp.jar 的已知问题。 It will be fixed in 21.3 when it's released.它将在 21.3 发布时修复。 In the meantime, you can remove this class from the ucp.jar:同时,您可以从 ucp.jar 中删除此类:
oracle/ucp/jdbc/UCPServletContextListener.class
From my experience, if you put jdbc/ucp jars to Tomcat's lib (which is recommended for productive system) and set provided
scope for them in Maven, the problem will disappear.根据我的经验,如果你将 jdbc/ucp jars 放到 Tomcat 的 lib(推荐用于生产系统)并在 Maven 中为它们设置provided
范围,问题就会消失。
Another option could be setting metadata-complete="true"
in web.xml (read more here and here )另一种选择可能是在web.xml 中设置metadata-complete="true"
( 在此处和此处阅读更多信息)
if you are using spring boot then you can use如果您使用的是弹簧靴,那么您可以使用
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3.0.0</version>
</dependency>
this dependency or update your maven project.此依赖项或更新您的 Maven 项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.