Tomcat 9 JDK 14 "java.lang.NoClassDefFoundError: javax/xml/ws/WebServiceRef" - java

I have a java web app that has been working normally with Netbeans 12 and Tomcat 9. However, I recently updated my JDK from 1.8.0 to 14.0.2 and now I get this error every time I try to run the project:
27-Jul-2020 23:29:47.565 SEVERE [http-nio-8080-exec-6] org.apache.catalina.core.StandardContext.filterStart Exception starting filter [Tomcat WebSocket (JSR356) Filter]
java.lang.NoClassDefFoundError: javax/xml/ws/WebServiceRef
at org.apache.catalina.core.DefaultInstanceManager.populateAnnotationsCache(DefaultInstanceManager.java:303)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:142)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:135)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:111)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4481)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5121)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:740)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:716)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:620)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1644)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809)
at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1479)
at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:900)
at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:592)
at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:319)
at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:88)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:625)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:498)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:796)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1372)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:832)
I've added javax.xml.ws to my pom file with no luck:
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
I have also tried without success:
Using the jakarta version instead of javax in my pom
Adding the jaxws-api jar to Tomcat's lib folder
Switching to JDK 9, 10, 11, 13
Switching to Tomcat 8.5, 10
I can even import/reference the WebServiceRef class in my code without a compile error, so I know it's there. Why am I getting this error/how do I fix it?
I can post more details if needed.
EDIT:
I believe the error is in starting Tomcat and not in running my project. My project is able to build without error - it's only when it's being deployed that I get the error. I've downloaded the source for Tomcat and can indeed see the use of the WebServiceRef class. My thought is that since javax.xml.ws is no longer included in JDK 9+, Tomcat's code is throwing an error. I just don't know how to add the library for Tomcat to use - adding it to the lib folder didn't work.

I was finally able to resolve this by adding the following JARs to Tomcat's lib folder (JAX WS API and all its dependencies):
jaxws-api-2.3.1
jaxb-api-2.3.1
javax.xml.soap-api-1.4.0
javax.annotation-api-1.3.2
java.activation-api-1.2.0

Related

System can't find: mchange-commons-java-0.2.11

I have a Spring boot project that using connection pool. It work properly in my computer but when my colleague pull the code from git then try to run. It thrown an error as below:
2018-02-28 14:49:24.527 WARN 11856 --- [ost-startStop-1] o.a.tomcat.util.scan.StandardJarScanner : Failed to scan [file:/C:/Users/ABC/.m2/repository/com/mchange/c3p0/0.9.5.2/mchange-commons-java-0.2.11.jar] from classloader hierarchy
java.io.FileNotFoundException: C:\Users\ABC\.m2\repository\com\mchange\c3p0\0.9.5.2\mchange-commons-java-0.2.11.jar (The system cannot find the file specified)
at java.util.zip.ZipFile.open(Native Method) ~[na:1.8.0_60]
at java.util.zip.ZipFile.<init>(ZipFile.java:219) ~[na:1.8.0_60]
at java.util.zip.ZipFile.<init>(ZipFile.java:149) ~[na:1.8.0_60]
at java.util.jar.JarFile.<init>(JarFile.java:166) ~[na:1.8.0_60]
at java.util.jar.JarFile.<init>(JarFile.java:130) ~[na:1.8.0_60]
at org.apache.tomcat.util.scan.JarFileUrlJar.<init>(JarFileUrlJar.java:60) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.tomcat.util.scan.JarFactory.newInstance(JarFactory.java:49) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:338) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:288) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.jasper.servlet.TldScanner.scanJars(TldScanner.java:262) [tomcat-embed-jasper-8.5.23.jar:8.5.23]
at org.apache.jasper.servlet.TldScanner.scan(TldScanner.java:104) [tomcat-embed-jasper-8.5.23.jar:8.5.23]
at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:101) [tomcat-embed-jasper-8.5.23.jar:8.5.23]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5196) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [tomcat-embed-core-8.5.23.jar:8.5.23]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
I also tried to add dependency for mchange-commons-java-0.2.11, but it still doesn't work:
<dependency>
<groupId>com.mchange</groupId>
<artifactId>mchange-commons-java</artifactId>
<version>0.2.11</version>
</dependency>
If you faced or had experiences about it, please leave me a comment/idea.
Your advice or suggestions will be much appreciated and welcomed!
From the StandardJarScanner javadoc:
The default JarScanner implementation scans the WEB-INF/lib directory
followed by the provided classloader and then works up the classloader
hierarchy. This implementation is sufficient to meet the requirements
of the Servlet 3.0 specification as well as to provide a number of
Tomcat specific extensions. The extensions are:
Scanning the classloader hierarchy (enabled by default) Testing all files to see if they are JARs (disabled by default)
Testing all directories to see if they are exploded JARs (disabled by default)
All of the extensions may be controlled via configuration.
To disable that particular jar from being scanned at startup you can add this spring boot specific property:
server.tomcat.additional-tld-skip-patterns=*mchange-commons-java*.jar
The problem is the c3p0 .jar file with the wrong Class-Path:
Somehow your spring boot transitive dependency is referring the wrong
mchange-commons-java. From your error, it's searching for path .m2\repository\com\mchange\c3p0\0.9.5.2\mchange-commons-java-0.2.11.jar. See highlighted c3p0.
Ideally the path has to be com\mchange\mchange-commons-java\0.2.11\mchange-commons-java-0.2.11.jar.
It seems that mchange-commons-java dependency is conflicted.
When you open pom.xml in eclipse or in any editor, you see dependency hierarchy where it lists all the transitive dependencies. See if there is any mchange-commons-java of c3p0 and if it is there, exclude that dependency. Then your explicit declaration of dependency of mchange-commons-java dependency may work.
My problem is solved this way, see if you can solve your problem.
Problem solving method https://my.oschina.net/antsdot/blog/1634440

Getting HTTP Status 500 - Servlet execution threw an exception

I Created a Dynamic web project where the input parameters are coming from UI(Index.html) going to servlet.java, but when I am trying to call auth in oAuthBean.java file its giving me an error.
Attached navigation view:
Exception:
Aug 24, 2017 3:18:42 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [clientCredServlet1] in context with path [/Java-Credit-Offers-Example] threw exception [Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: org.apache.http.HttpEntity
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
at controller.clientCredServlet.doPost(clientCredServlet.java:45)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
It looks like your servlet uses Apache http client (that's where org.apache.http.HttpEntity is coming from), but corresponding dependency jar is not present in resulting deployment, most likely because there is a lack of configuration glue between Maven and Eclipse WTP plugin which deploys to and runs your Tomcat from IDE. That lack appeared because it seems that Maven project has been created outside of Eclipse.
Option 1. Leave things as is and do quickfix (worse)
Try executing under your project root folder:
mvn eclipse:eclipse -Dwtpversion=2.0
and reopen Eclipse workspace then
According to Maven Eclipse plugin documentation when the wtpversion flag is explicitly set, maven generates necessary workspace configuration for WTP plugins (including Tomcat one) in order to let them understand how to obtain Maven dependencies during deployments from Eclipse
Option 2. Rely on built-in IDE integration with Maven (best for long term)
Examine following great answer which, at some approximation, describes why, and how to rely on built-in Eclipse Maven support. This approach eliminates the problem with missing dependencies in IDE deployments as well, but requires more effort to migrate project onto, which however is quite minor while your project is at the beginning stage

IntelliJ java.lang.ClassNotFoundException: com.mysql.jdbc.Driver - connecting to XAMPP MySQL database

Trying to create a basic login page in Java using IntelliJ. I've added the JAR to the CLASSPATH using these instructions: Adding Jar files to IntellijIdea classpath. The error I'm getting is below.
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1285)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at main.Validate.checkUser(Validate.java:17)
at main.Login.doPost(Login.java:23)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:341)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1441)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
20-Mar-2017 16:14:19.453 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory D:\Users\MYNAME\apache-tomcat-8.5.12\webapps\manager
20-Mar-2017 16:14:19.523 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory D:\Users\MYNAME\apache-tomcat-8.5.12\webapps\manager has finished in 70 ms
The class that connects to the DB is called Validate;
package main;
import java.sql.*;
public class Validate
{
public static boolean checkUser(String username,String password)
{
boolean st =false;
try{
//loading drivers for mysql
Class.forName("com.mysql.jdbc.Driver");
//creating connection with the database
Connection con=DriverManager.getConnection
("jdbc:mysql:/ /localhost:3306/wpdcourseworkdb","root","");
PreparedStatement ps =con.prepareStatement
("select * from users where username=? and password=?");
ps.setString(1, username);
ps.setString(2, password);
ResultSet rs =ps.executeQuery();
st = rs.next();
}catch(Exception e)
{
e.printStackTrace();
}
return st;
}
}
Adding libraries to IntelliJ's classpath doesn't add them to the build artifact, e.g. the .jar file. If you're using Maven, you should add the dependency to the POM file and use the maven-assembly-plugin to create a fat archive containing all needed dependencies:
https://maven.apache.org/plugins/maven-assembly-plugin/usage.html
EDIT: after a discussion in the chat it turned out the user was trying to deploy a simple .jar on tomcat whereas he thought he was deploying a web archive. The thin .jar didn't contain the required dependencies and tomcat also didn't supply them as part of its core.

Servlet error when changing JAR from compile to provided

I am currently trying to move a JAR from a deployed WAR to just being included in the Tomcat library. Here's the dependency in my pom.xml
<dependency>
<groupId>psft.pt8</groupId>
<artifactId>psjoa</artifactId>
<version>8.54.22</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
When scope is <scope>compile</scope> everything works fine. I build the artifact, deploy it in Tomcat, and can access the WSDL. When I change scope to provided, I can still build the artifact, deploy it in Tomcat, it LOOKS like it's fine, but then when attempting to go to the WSDL I reach this error.
The server encountered an internal error that prevented it from fulfilling this request: Servlet.init() for servlet spring-ws threw exception
javax.servlet.ServletException: Servlet.init() for servlet spring-ws threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
psiprobe.Tomcat80AgentValve.invoke(Tomcat80AgentValve.java:45)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:676)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)
Not sure where to begin.
Solution 1.
If you don't want including artifact psft.pt8:psjoa:8.54.22 inside WAR generated artifact
use <scope>provided</scope> in pom.xml
put psft.pt8:psjoa:8.54.22 JAR file inside $CATALINA_HOME\lib (on macOS, Linux) or %CATALINA_HOME%\lib (on Windows operating system).
Solution 2.
If you want including artifact psft.pt8:psjoa:8.54.22 inside WAR generated artifact, use <scope>compile</scope> in pom.xml.

Jersey errors after deploying to tomcat, works fine in Eclipse

I've lost hours trying to pinpoint this annoying issue. I've created a simple Java app that exposes a few REST services using Jersey.
When debugging the application in Eclipse, using a Tomcat 8 server, everything works fine. I then export the project to a WAR file, deploy it to a real Tomcat 8 server, and when I try to call the REST services, I get the below error. I've checked the obvious things: making sure I'm using the correct Java version on the server, making sure the libraries are included, ... But alas, I'm stuck.
type Exception report
message Servlet.init() for servlet Jersey REST Service threw exception
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet.init() for servlet Jersey REST Service threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)
root cause
java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;
org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:309)
org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:338)
org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:171)
org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:363)
javax.servlet.GenericServlet.init(GenericServlet.java:158)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)
All important libraries for the project are added in the WEB-INF, which are the following:
aopalliance-repackaged-2.4.0-b10.jar
asm-debug-all-5.0.2.jar
commons-beanutils-1.9.2.jar
commons-collections-3.2.1.jar
commons-collections4-4.0.jar
commons-logging-1.2.jar
gson-2.3.1.jar
hk2-api-2.4.0-b10.jar
hk2-locator-2.4.0-b10.jar
hk2-utils-2.4.0-b10.jar
httpclient-4.4.1.jar
httpcore-4.4.1.jar
java-json.jar
javassist-3.18.1-GA.jar
javax.annotation-api-1.2.jar
javax.inject-2.4.0-b10.jar
javax.json-1.0.2.jar
javax.servlet-api-3.0.1.jar
javax.ws.rs-api-2.0.1.jar
jaxb-api-2.2.7.jar
jersey-client-1.7.jar
jersey-client.jar
jersey-common.jar
jersey-container-servlet-core.jar
jersey-container-servlet.jar
jersey-core-1.7.jar
jersey-guava-2.17.jar
jersey-json-1.7.jar
jersey-media-jaxb.jar
jersey-server.jar
joda-time-2.3.jar
log4j-1.2.17.jar
org.osgi.core-4.2.0.jar
org.restlet.ext.gson-2.3.1.jar
org.restlet.ext.json.jar
org.restlet.jar
osgi-resource-locator-1.0.1.jar
persistence-api-1.0.jar
unboundid-ldapsdk-se.jar
validation-api-1.1.0.Final.jar
I believe this is not because of missing jar.. I believe it is class loading issue. The jersey jars are not being loaded (or) might have been loaded the wrong version. Could you please check the dependencies properly and check for duplicate jars for jersey in your application.
Also Please try by undeploying appliation and deploying again.. This might remove all the classes that were already loaded for taht application and Tomcat might intialize class loading again..
Hope this works...

Categories

Resources