Jersey试图加载类错误

时间:2014-02-03 23:21:44

标签: maven jersey shiro

我正试图从球衣1.17转到2.31(分钟)。我的代码之前正在运行,但现在我需要将我的运动衫移动几个版本,因为我需要使用jaxrs 2.0中的Client和WebTarget类,并且1.17球衣会导致一些错误。


pom.xml

<dependencies>
 <dependency>
  <groupId>javax.ws.rs</groupId>
  <artifactId>javax.ws.rs-api</artifactId>
  <version>2.0</version>
 </dependency>
 <dependency>
  <groupId>org.glassfish.jersey.core</groupId>
  <artifactId>jersey-common</artifactId>
  <version>2.5</version>
 </dependency>
 <!-- <dependency>
  <groupId>com.sun.jersey</groupId>
  <artifactId>jersey-server</artifactId> 
  <version>1.17</version>
 </dependency> -->
 <dependency>
  <groupId>org.glassfish.jersey.core</groupId>
  <artifactId>jersey-server</artifactId>
  <version>2.3.1</version>
 </dependency>
 <!--<dependency>
  <groupId>com.sun.jersey</groupId>
  <artifactId>jersey-json</artifactId>
  <version>1.17</version>
 </dependency> -->
 <!-- <dependency> 
  <groupId>com.sun.jersey</groupId>
  <artifactId>jersey-servlet</artifactId>
  <version>1.17</version>
 </dependency> -->
 <dependency>
  <groupId>org.glassfish.jersey.containers</groupId>
  <artifactId>jersey-container-servlet</artifactId>
  <version>2.3.1</version>
 </dependency>
</dependencies>

我的web.xml是这样的:

<servlet-mapping>
    <servlet-name>jersey-servlet</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<servlet>
  <servlet-name>jersey-servlet</servlet-name>
<!-- <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class> -->
  <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
  <init-param>
    <!-- <param-name>com.sun.jersey.config.property.packages</param-name> -->
    <param-name>jersey.config.server.provider.packages</param-name>
    <param-value>com.mycomp.stuff.interfaces</param-value>
  </init-param>
  <init-param>
     <param-name>debug</param-name>
     <param-value>0</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>

在容器甚至接近我的代码之前,我在我的日志文件中得到了~5次:

*_Feb 03, 2014 5:45:41 PM org.apache.catalina.loader.WebappClassLoader loadClass INFO: Illegal access: this web application instance has been stopped already. Could not load org.glassfish.hk2.internal.PerThreadContext$1. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.

java.lang.IllegalStateException
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1588)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
        at java.lang.Class.getDeclaredConstructors(Class.java:1901)
        at org.jvnet.hk2.internal.Utilities$4.run(Utilities.java:1239)
        at org.jvnet.hk2.internal.Utilities$4.run(Utilities.java:1235)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.jvnet.hk2.internal.Utilities.getAllConstructorKeys(Utilities.java:1235)
        at org.jvnet.hk2.internal.Utilities.getAllConstructors(Utilities.java:1222)
        at org.jvnet.hk2.internal.Utilities.findProducerConstructor(Utilities.java:1141)
        at org.jvnet.hk2.internal.DefaultClassAnalyzer.getConstructor(DefaultClassAnalyzer.java:73)
        at org.glassfish.jersey.internal.inject.JerseyClassAnalyzer.getConstructor(JerseyClassAnalyzer.java:143)
        at org.jvnet.hk2.internal.Utilities.getConstructor(Utilities.java:157)
        at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:125)
        at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:176)
        at org.jvnet.hk2.internal.SystemDescriptor.internalReify(SystemDescriptor.java:647)
        at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:602)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:377)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:1780)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1103)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1050)
        at org.jvnet.hk2.internal.ServiceLocatorImpl$5.run(ServiceLocatorImpl.java:1029)
        at org.jvnet.hk2.internal.ServiceLocatorImpl$5.run(ServiceLocatorImpl.java:1025)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.protectedGetAllServiceHandles(ServiceLocatorImpl.java:1025)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.resolveContext(ServiceLocatorImpl.java:1683)
        at org.jvnet.hk2.internal.MethodInterceptorImpl.intercept(MethodInterceptorImpl.java:79)
        at org.glassfish.jersey.internal.inject.UriInfoInjectee$$EnhancerByCGLIB$$453ec21b.finalize(<generated>)
        at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
        at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:101)
        at java.lang.ref.Finalizer.access$100(Finalizer.java:32)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:190)_*

任何想法为什么会发生这种情况,或者有人能指出我正确的方向来进一步询问这个问题?当配置文件发生了所有变化时,为什么会发生这种情况?

0 个答案:

没有答案