0

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

  • I bet the missing Oralce jar is declared as a `provided`-scoped dependency and is expected to be found under Tomcat's `lib` folder, but went missing after updating Tomcat's version. – JockX Jan 16 '22 at 21:29
  • @JockX looks like the class is found but it doesn't have a noargs ctor. – tgdavies Jan 16 '22 at 22:15

2 Answers2

0

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

0

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.