使用泽西声明式链接时出现异常

时间:2014-08-14 13:49:16

标签: jersey-2.0

我正在尝试使用Jersey描述性链接。

我的泽西JAR来自jaxrs-ri-2.11.zip捆绑。

我使用与捆绑包分开下载的jersey-declarative-linking-2.11.jar。

这里发生了什么:

我的申请:

 ...
import org.glassfish.jersey.linking.DeclarativeLinkingFeature;
 ...
@PostConstruct
    private void setup()
    {
    ...
    register(DeclarativeLinkingFeature.class);
    }
 ...

此时,eTomcat stdout.log中记录了以下异常(抱歉需要很长的跟踪):

 SEVERE: StandardWrapper.Throwable
 MultiException stack 1 of 3
 java.lang.IllegalStateException: A descriptor SystemDescriptor(
    implementation=org.glassfish.jersey.server.internal.process.ServerProcessingBinder$UriRoutingContextFactory
    contracts={javax.ws.rs.core.UriInfo,javax.ws.rs.container.ResourceInfo,org.glassfish.jersey.server.ExtendedUriInfo}
    scope=org.glassfish.jersey.process.internal.RequestScoped
    qualifiers={}
    descriptorType=PROVIDE_METHOD
    descriptorVisibility=NORMAL
    metadata=
    rank=0
    loader=org.glassfish.hk2.utilities.binding.AbstractBinder$2@245b573f
    proxiable=true
    proxyForSameScope=false
    analysisName=null
    id=14
    locatorId=0
    identityHashCode=1757215678
    reified=true) requires a proxy, but the proxyable library is not on the classpath
    at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2121)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)
    at org.glassfish.jersey.internal.inject.ContextInjectionResolver.resolve(ContextInjectionResolver.java:104)
    at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:214)
    at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:237)
    at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:360)
    at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
    at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:114)
    at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:102)
    at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
    at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
    at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:153)
    at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2151)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)
    at org.glassfish.jersey.internal.inject.Providers.getAllRankedProviders(Providers.java:235)
    at org.glassfish.jersey.server.ApplicationHandler.getProcessingProviders(ApplicationHandler.java:657)
    at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:448)
    at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:163)
    at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:323)
    at org.glassfish.jersey.internal.Errors$2.call(Errors.java:289)
    at org.glassfish.jersey.internal.Errors$2.call(Errors.java:286)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:320)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:285)
    at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:310)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:170)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1279)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1192)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1229)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    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:744)
 MultiException stack 2 of 3
 java.lang.IllegalArgumentException: While attempting to resolve the dependencies of org.glassfish.jersey.linking.ResponseLinkFilter errors were found
    at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:249)
    at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:360)
    at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
    at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:114)
    at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:102)
    at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
    at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
    at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:153)
    at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2151)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)
    at org.glassfish.jersey.internal.inject.Providers.getAllRankedProviders(Providers.java:235)
    at org.glassfish.jersey.server.ApplicationHandler.getProcessingProviders(ApplicationHandler.java:657)
    at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:448)
    at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:163)
    at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:323)
    at org.glassfish.jersey.internal.Errors$2.call(Errors.java:289)
    at org.glassfish.jersey.internal.Errors$2.call(Errors.java:286)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:320)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:285)
    at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:310)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:170)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1279)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1192)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1229)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    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:744)
 MultiException stack 3 of 3
 java.lang.IllegalStateException: Unable to perform operation: resolve on org.glassfish.jersey.linking.ResponseLinkFilter
    at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:389)
    at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
    at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:114)
    at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:102)
    at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
    at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
    at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:153)
    at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2151)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)
    at org.glassfish.jersey.internal.inject.Providers.getAllRankedProviders(Providers.java:235)
    at org.glassfish.jersey.server.ApplicationHandler.getProcessingProviders(ApplicationHandler.java:657)
    at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:448)
    at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:163)
    at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:323)
    at org.glassfish.jersey.internal.Errors$2.call(Errors.java:289)
    at org.glassfish.jersey.internal.Errors$2.call(Errors.java:286)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:320)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:285)
    at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:310)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:170)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1279)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1192)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1229)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    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:744)

我使用错误的球衣 - 声明 - 链接JAR吗?是否有解决此问题所需的附加JARS?

请告诉。

谢谢。

1 个答案:

答案 0 :(得分:9)

我缺少javassist-3.18.1-GA.jar。