I am learning Java rest webservices using Jersey Framework. Created one sample project in eclipse but not able to deploy it in tomcat. Below libraries added in eclipse project. Can anyone please help me out here
cglib-2.2.jar
hk2-api-2.3.0-b06.jar
hk2-locator-2.1.63.jar
hk2-utils-2.5.0-b04.jar
javassist.jar
javax-inject.jar
javax.annotation-api-1.2.jar
javax.ws.rs-api-2.0.jar
javax.ws.rs.jar
jersey-bean-validation-2.17.jar
jersey-client.jar
jersey-common.jar
jersey-container-servlet-core.jar
jersey-container-servlet.jar
jersey-guava-2.7.jar
jersey-media-jaxb.jar
jersey-server.jar
validation-api-1.0.0.GA.jar
Getting below error while running project in Apache server inside eclipse.
SEVERE: StandardWrapper.Throwable
java.lang.NoSuchMethodError: org.glassfish.hk2.utilities.AbstractActiveDescriptor.<init>(Ljava/util/Set;Ljava/lang/Class;Ljava/lang/String;L
java/util/Set;Lorg/glassfish/hk2/api/DescriptorType;Lorg/glassfish/hk2/api/DescriptorVisibility;ILjava/lang/Boolean;Ljava/lang/String;Ljava/
util/Map;)V
at org.jvnet.hk2.internal.ConstantActiveDescriptor.<init>(ConstantActiveDescriptor.java:113)
at org.jvnet.hk2.internal.Utilities.getLocatorDescriptor(Utilities.java:951)
at org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl.initialize(ServiceLocatorGeneratorImpl.java:71)
at org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl.create(ServiceLocatorGeneratorImpl.java:96)
at org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.internalCreate(ServiceLocatorFactoryImpl.java:270)
at org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.create(ServiceLocatorFactoryImpl.java:230)
at org.glassfish.jersey.internal.inject.Injections._createLocator(Injections.java:138)
at org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:123)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:330)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5253)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5543)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source) enter code here
If you see your exception
Apache Jersey exception:java.lang.NoSuchMethodError : org.glassfish.hk2.utilities.AbstractActiveDescriptor
as per my experience , This Exception NoSuchMethodError
because of Incompatible jar has been added to your Project library
.
Use latest jar hk2-api-2.5.0-b04.jar
instead of hk2-api-2.3.0-b06.jar
. Probably this will solve your problem..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With