java - Server Tomcat v8.5 failed to start for hello world Jersey Web Service -


i setting jersey web service cant run, apache tomcat 8.5 error'ing out. see details below simple code, libs , error.

i created dynamic web project... added jersey files... (am missing any?)

  • javax.ws.rs-api.2.0.1.jar
  • jersey-client.jar
  • jersey-common.jar
  • jersey-contaner-servlet.jar
  • jersey-container-servlet.jar
  • jersey-media-jaxb.jar
  • jersey-server.jar

my web.xml

<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="webapp_id" version="3.1">  <servlet>     <servlet-name>myapi</servlet-name>     <servlet-class>org.glassfish.jersey.servlet.servletcontainer</servlet-class>     <init-param>         <param-name>jersey.config.server.provider.packages</param-name>         <!-- package resource classes -->         <param-value>ws</param-value>     </init-param> </servlet> <servlet-mapping>     <servlet-name>testapi</servlet-name>     <url-pattern>/*</url-pattern> </servlet-mapping> </web-app> 

my java class

package ws; import javax.ws.rs.*; import javax.ws.rs.core.*;      @path("test")     public class connect {         @get         @path("test")         @produces(mediatype.text_plain)         public string hello(){             return "hello world";         }     } 

my error before pop-up saying failed start apachev8.5

severe: child container failed during start java.util.concurrent.executionexception: org.apache.catalina.lifecycleexception: failed start component [standardengine[catalina].standardhost[localhost].standardcontext[/thisapi]]     @ java.util.concurrent.futuretask.report(unknown source)     @ java.util.concurrent.futuretask.get(unknown source)     @ org.apache.catalina.core.containerbase.startinternal(containerbase.java:911)     @ org.apache.catalina.core.standardhost.startinternal(standardhost.java:890)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1403)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1393)     @ java.util.concurrent.futuretask.run(unknown source)     @ java.util.concurrent.threadpoolexecutor.runworker(unknown source)     @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source)     @ java.lang.thread.run(unknown source) caused by: org.apache.catalina.lifecycleexception: failed start component [standardengine[catalina].standardhost[localhost].standardcontext[/thisapi]]     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:167)     ... 6 more caused by: java.lang.noclassdeffounderror: jersey/repackaged/com/google/common/base/function     @ org.glassfish.jersey.internal.servicefinder.<clinit>(servicefinder.java:165)     @ org.glassfish.jersey.servlet.internal.servletcontainerproviderfactory.getallservletcontainerproviders(servletcontainerproviderfactory.java:66)     @ org.glassfish.jersey.servlet.init.jerseyservletcontainerinitializer.onstartup(jerseyservletcontainerinitializer.java:134)     @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5178)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     ... 6 more caused by: java.lang.classnotfoundexception: jersey.repackaged.com.google.common.base.function     @ org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1285)     @ org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1119)     ... 11 more 

you missing jersey-guava.jar, should contain package-rebundled versions of google guava classes, including function. jersey repackages exact version need can still use version of guava prefer original package structure. see https://stackoverflow.com/a/22069399/27905 .

https://mvnrepository.com/artifact/org.glassfish.jersey.bundles.repackaged/jersey-guava


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -