M.Movaffagh
M.Movaffagh

Reputation: 1312

500 Internal server error on apache tomcat server

i have a war file and i deployed it on my first server. every thing is okay there. you can test it on http://185.126.201.83:10808/crmapi/rest/v1/authentication/hi (port is different because it is behind a firewall) but in my new server i get below error and everything are same in both server. what is wrong? you can test it on : http://185.21.76.71:8080/crmapi/rest/v1/authentication/hi

type Exception report

message Servlet.init() for servlet com.crmapi.services.ApplicationConfig threw exception

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet.init() for servlet com.crmapi.services.ApplicationConfig 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:616)
    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)
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:315)
    org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:170)
    org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358)
    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:616)
    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)
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.36 logs.

ubuntu 16.04 Server x64 and Apache Tomcat/8.0.36

Upvotes: 2

Views: 37840

Answers (4)

Pranjal Soni
Pranjal Soni

Reputation: 1

One of the other error that we are possibly do that we are not declaring our servlet class as public This thing we need to remember because servlet container always looks for servlet class in public area so our servlet file must be public Otherwise we will get Error 500- internal server error.

Upvotes: 0

Riddhi Sanyal
Riddhi Sanyal

Reputation: 473

Looks like you have jar mismatch of JAX-RS versions. Use maven to control your JAX-RS version. If you are using jersey, use 2.23.2 or more versions.

You can check your successful deployment via http://185.21.76.71:8080/crmapi/application.wadl

Upvotes: 1

Saurabh Chaturvedi
Saurabh Chaturvedi

Reputation: 2176

Apache Tomcat stack trace tells it all .Your issue is definitely having multiple JAX-RS jars in the classpath of your application. It looks like javax.ws.rs.core.Application class is loaded from some Jar but it doesn't have the getProperties() method that returns a Java.util.Map . You need to strictly check presence of duplicate jars .If you are not able to find it manually , you can use a tool like JHade to detect presence of duplicate jars .But if you are too sure that application class path has only one JAX-RS jar , please inspect carefully whether it has the required getProperties() method or not in the javax.ws.rs.core.Application class. If you debug your code on these lines, you may end up with a solution. Let me know if that helps you :) . PS - JAX RS 1.x jars do not have getProperties() method but JAX-RS 2.x have .

Upvotes: 2

Andrew Lygin
Andrew Lygin

Reputation: 6197

It looks that the JRE versions differ on your servers.

Upvotes: 0

Related Questions