users@jersey.java.net

[Jersey] Re: Exception occurs (tomcat 7.0.4 & jersey 2.4)

From: Libor Kramolis <libor.kramolis_at_oracle.com>
Date: Thu, 7 Nov 2013 09:38:20 +0100

Hello.

Do you have JAX-RS API jar in your application?

I Jersey 1.x it was part of jersey-core. However Jersey 2 depends on separate artefact javax.ws.rs-api-2.0.jar.

Can you check?

Thanks,
-lk


On 07 Nov 2013, at 07:01, Jamshaid Ashraf <jamshaid.qe_at_gmail.com> wrote:

> Hi,
>
> I'm new with jersey 2.4 and trying to develop web services in java eclipse and hosting server is tomcat 7.0.4.
>
> Same code executing fine with jersey 1.17 but after updating "jersey 2.4" references and servlet mapping in project following exception occurs.
>
> SEVERE: A child container failed during start
> java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/jersey2.x]]
> at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
> at java.util.concurrent.FutureTask.get(FutureTask.java:111)
> at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
> at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
> at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
> at java.util.concurrent.FutureTask.run(FutureTask.java:166)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:722)
> Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/jersey2.x]]
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
> ... 7 more
> Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/ProcessingException
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
> at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2895)
> at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
> at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
> at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
> at java.lang.Class.getDeclaredFields0(Native Method)
> at java.lang.Class.privateGetDeclaredFields(Class.java:2317)
> at java.lang.Class.getDeclaredFields(Class.java:1762)
> at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
> at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261)
> at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:140)
> at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67)
> at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405)
> at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
> at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
> at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
> at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
> at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269)
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> ... 7 more
> Caused by: java.lang.ClassNotFoundException: javax.ws.rs.ProcessingException
> at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
> at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
> ... 28 more
>
> Nov 06, 2013 5:34:46 PM org.apache.catalina.core.ContainerBase startInternal
> SEVERE: A child container failed during start
> java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
> at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
> at java.util.concurrent.FutureTask.get(FutureTask.java:111)
> at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
> at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> at org.apache.catalina.startup.Catalina.start(Catalina.java:684)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
> Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
> at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
> at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
> at java.util.concurrent.FutureTask.run(FutureTask.java:166)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:722)
> Caused by: org.apache.catalina.LifecycleException: A child container failed during start
> at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
> at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> ... 7 more
>
> Nov 06, 2013 5:34:46 PM org.apache.catalina.startup.Catalina start
> SEVERE: Catalina.start:
> org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
> at org.apache.catalina.startup.Catalina.start(Catalina.java:684)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
> Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
> at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> ... 7 more
> Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
> at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> ... 9 more
> Caused by: org.apache.catalina.LifecycleException: A child container failed during start
> at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
> at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> ... 11 more
>
> Regards,
> Jamshaid