2

Ojdbc8, ons, ucp jars are upgraded to 21.1.0.0 version. When trying to start the app on tomcat server, it's throwing Nosuchmethod exception. Logged in the Tomcat's localhost.log file. 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)

Mahi
  • 21
  • 3

3 Answers3

2

This is a known issue with ucp.jar in 21.1. It will be fixed in 21.3 when it's released. In the meantime, you can remove this class from the ucp.jar:

  oracle/ucp/jdbc/UCPServletContextListener.class
Jean de Lavarene
  • 3,461
  • 1
  • 20
  • 28
  • Thank you so much for the info.. May I know if removing that class will impact anything? – Mahi Jun 19 '21 at 05:44
  • 1
    This is a new feature introduced in 21c to automatically startup UCP using a Servlet Context Listener. It works on JBoss but not on Tomcat. You can safely remove it if using Tomcat. It won't have any impact. – Jean de Lavarene Jun 19 '21 at 08:40
  • Great then.. Thanks again – Mahi Jun 20 '21 at 14:31
2

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.

Another option could be setting metadata-complete="true" in web.xml (read more here and here)

Kirill
  • 6,762
  • 4
  • 51
  • 81
0

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.

  • I have a Spring Boot project using v21 driver and I do not have the error from the question. With Spring Boot you can even omit the ``, it will be acquired from parent Spring Boot pom – Kirill Aug 24 '21 at 16:57