2016-08-05 18 views
1

私はRed Hat JBoss Developer Studioにjava.lang.ClassNotFoundException

は、私は非常に奇妙な問題を持って使用したJBoss 6.3の残りのアプリケーションを開発しようとしていますこんにちは:私はfiddllerを経由して私のRESTサービスを初めてアクセスするときに私が得ます次の例外を除いて:

15:49:18,053 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/OASExtention-war].[javax.ws.rs.core.Application]] (http-localhost/127.0.0.1:8080-2) JBWEB000236: Servlet.service() for servlet javax.ws.rs.core.Application threw exception: java.lang.ClassNotFoundException: org.codehaus.jackson.xc.JaxbAnnotationIntrospector from [Module "deployment.OASExtention-war.war:main" from Service Module Loader] 
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final-redhat-1] 
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final-redhat-1] 
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final-redhat-1] 
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final-redhat-1] 
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final-redhat-1] 
    at org.codehaus.jackson.jaxrs.MapperConfigurator._resolveIntrospector(MapperConfigurator.java:169) [jackson-jaxrs-1.7.1.jar:1.7.1] 
    at org.codehaus.jackson.jaxrs.MapperConfigurator._resolveIntrospectors(MapperConfigurator.java:144) [jackson-jaxrs-1.7.1.jar:1.7.1] 
    at org.codehaus.jackson.jaxrs.MapperConfigurator._setAnnotations(MapperConfigurator.java:131) [jackson-jaxrs-1.7.1.jar:1.7.1] 
    at org.codehaus.jackson.jaxrs.MapperConfigurator.getDefaultMapper(MapperConfigurator.java:70) [jackson-jaxrs-1.7.1.jar:1.7.1] 
    at org.codehaus.jackson.jaxrs.JacksonJsonProvider.locateMapper(JacksonJsonProvider.java:609) [jackson-jaxrs-1.7.1.jar:1.7.1] 
    at org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:404) [jackson-jaxrs-1.7.1.jar:1.7.1] 
    at org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:106) [resteasy-jaxrs-2.3.8.Final-redhat-3.jar:] 
    at org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.read(GZIPDecodingInterceptor.java:63) [resteasy-jaxrs-2.3.8.Final-redhat-3.jar:] 
    at org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:109) [resteasy-jaxrs-2.3.8.Final-redhat-3.jar:] 
    at org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:169) [resteasy-jaxrs-2.3.8.Final-redhat-3.jar:] 
    at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:136) [resteasy-jaxrs-2.3.8.Final-redhat-3.jar:] 
    at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:159) [resteasy-jaxrs-2.3.8.Final-redhat-3.jar:] 
    at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) [resteasy-jaxrs-2.3.8.Final-redhat-3.jar:] 
    at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) [resteasy-jaxrs-2.3.8.Final-redhat-3.jar:] 
    at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) [resteasy-jaxrs-2.3.8.Final-redhat-3.jar:] 
    at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) [resteasy-jaxrs-2.3.8.Final-redhat-3.jar:] 
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) [resteasy-jaxrs-2.3.8.Final-redhat-3.jar:] 
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) [resteasy-jaxrs-2.3.8.Final-redhat-3.jar:] 
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.8.Final-redhat-3.jar:] 
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.8.Final-redhat-3.jar:] 
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.8.Final-redhat-3.jar:] 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4] 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4] 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4] 
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19] 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4] 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4] 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4] 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4] 
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4] 
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4] 
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4] 
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_73] 

サーバーは、ステータスコード500を返します。これはサービスへの最初の呼び出しで発生します。 2回目のコールレストサービスは期待通りに機能します。

私の機能は、私は本当に混乱し、そして任意の提案を待っています。この

@POST 
@Path("matterNote") 
@Consumes("application/json") 
@Produces("application/json") 
public String matterNoteFunction(JSONObject json) throws IOException{ return "bla"; } 

ように見えます。

EDIT:

私はDownload jackson-xc.jarを追加しようとしたが、(サービスの最初の呼び出し時に)followin例外が発生しました:

java.lang.VerifyError: class org.codehaus.jackson.xc.JaxbAnnotationIntrospector overrides final method findDeserializer.(Lorg/codehaus/jackson/map/introspect/Annotated;)Ljava/lang/Object; 
    java.lang.ClassLoader.defineClass1(Native Method) 
    java.lang.ClassLoader.defineClass(Unknown Source) 
    org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:361) 
    org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:482) 
    org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:277) 
    org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:92) 
    org.jboss.modules.Module.loadModuleClass(Module.java:568) 
    org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) 
    org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) 
    org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) 
    org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) 
    org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) 
    org.codehaus.jackson.jaxrs.MapperConfigurator._resolveIntrospector(MapperConfigurator.java:169) 
    org.codehaus.jackson.jaxrs.MapperConfigurator._resolveIntrospectors(MapperConfigurator.java:144) 
    org.codehaus.jackson.jaxrs.MapperConfigurator._setAnnotations(MapperConfigurator.java:131) 
    org.codehaus.jackson.jaxrs.MapperConfigurator.getDefaultMapper(MapperConfigurator.java:70) 
    org.codehaus.jackson.jaxrs.JacksonJsonProvider.locateMapper(JacksonJsonProvider.java:609) 
    org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:404) 
    org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:106) 
    org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.read(GZIPDecodingInterceptor.java:63) 
    org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:109) 
    org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:169) 
    org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:136) 
    org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:159) 
    org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) 
    org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) 
    org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) 
    org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) 
    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) 
    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) 
    org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) 
    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) 
    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847) 

ありがとうございました。

答えて

1

私は道次の問題を解決しました:私のアプリケーションでは、私は適切に機能するためにクラスパスに提示されるように、他の依存関係を必要とJSON-lib.jarを使用しています。私は、次のものを添加し、古い依存関係を削除:

enter image description here

を、問題が去っていきました。

+1

素晴らしい....あなたが望ましくない依存関係を必要としない限り、それを使用しないでください。 – Gokul

1
I think XC Jackson lib is optional and The XC package allows you to use Xml Annotations (JAXB) in addition to the Jackson Annotations for mapping classes unless you need JAXB support just ignore the issue. 
+0

この問題を解決していただきありがとうございます。私は答えを投稿するつもりです。 –

2

私は(春を使用して)同じ問題を持っていた:

<dependency> 
     <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-rt-rs-extension-providers</artifactId> 
     <version>3.0.2</version> 
    </dependency> 
    <dependency> 
     <groupId>org.codehaus.jackson</groupId> 
     <artifactId>jackson-jaxrs</artifactId> 
     <version>1.9.0</version> 
    </dependency> 

が、私はマッパー定義によってbeans.xmlの中にプロバイダ定義を拡張する場合:

<jaxrs:providers> 
     <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"> 
      <property name="mapper" ref="jacksonMapper" /> 
     </bean> 
</jaxrs:providers> 
<bean id="jacksonMapper" class="org.codehaus.jackson.map.ObjectMapper" /> 

それは初期ずに仕事を始め例外。

関連する問題