Error deploy java jersey with Tomcat 8.5


I am using IDE Myeclipse CI 10 , the code works perfectly when publishing and consuming the service from my IDE, but when I deploy the service I tried to consume it from my server Tomcat 8.5 shows me an error.

Java code

package logic;

import com.sun.jersey.spi.resource.Singleton;

public class Principal {
 public Principal(){}

 public String hello(){
     return "Hello";

I use Postman to test from my IDE and it works. I export the .war and from the Manager app of tomcat I deploy the .war, it is displayed correctly but when I use it it shows me the following error

Configuring my web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="" xmlns="" xsi:schemaLocation="" id="WebApp_ID" version="3.1">
    <description>JAX-RS Tools Generated - Do not modify</description>
    <servlet-name>JAX-RS Servlet</servlet-name>
    <servlet-name>JAX-RS Servlet</servlet-name>

Configuring my /opt/tomcat/webapps/host-manager/META-INF/context.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context antiResourceLocking="false" privileged="true" >
 <!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />-->
  <Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPre$
asked by Rastalovely 07.05.2018 в 16:23

1 answer


It is possible that your IDE has already added in the classpath the necessary package, while Tomcat needs you to add to your project (I assume you use Maven) the following dependency:

answered by 07.05.2018 / 16:41