Home > Software design >  Problem with oracle.ucp.jdbc.UCPServletContextListener
Problem with oracle.ucp.jdbc.UCPServletContextListener

Time:01-17

I'm running a small java application on TomCat 9.0.56 for class that has to connect to a database. I'm using jdbc (ojdbc8 - 19.3.0.0). It was working fine untill it started displaying the following error:

16-Jan-2022 21:03:42.631 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.listenerStart Error configuring application listener [oracle.ucp.jdbc.UCPServletContextListener] java.lang.NoSuchMethodException: oracle.ucp.jdbc.UCPServletContextListener.<init>()

I'm new to tomcat and I'm not sure how to fix this. I have re-installed everything but it hasn't worked again. Any idea?

IDE - IntelliJ 2021.2.3 JDK - 17.0.1

CodePudding user response:

I am sure you must be using Oracle JDBC and UCP binaries from 21.1 release instead of 19.3 release. You can check and validate the ojdbc and ucp jar version using below command:
java -jar ucp.jar
java -jar ojdbc8.jar

The issue you have described above is a known issue with ucp 21.1 release jars. In order to fix the issue, you can simply switch to ucp/jdbc 21.3 release. Please make sure to upgrade both ucp.jar and ojdbc8.jar to 21.3, not just one. Also, make sure to remove all duplicate jars(if any) from the class-path. Here is a related thread for the same issue:
Ojdbc8 jars upgrade to 21.1.0.0 throws Nosuchmethod exception UCPservletContextListener init

CodePudding user response:

Weirdly, uninstalling and deleting all tomcat versions previously used and installing a new one and setting up a new configuration made the error stop happening and the app is running nicely again.

I had done this before with no results, but this time it did work.

  •  Tags:  
  • Related