2017-01-12 11 views
0

Weblogic 12.2.1でJersey 2.22.1を使用しています。管理対象サーバには、Jax-RS v1サービスがデプロイされています。ジャクソンは正しく動作しておらず、非json以外のサービスも期待どおりに動作しています。Weblogic 12.2.1 Infrastructure Jersey Jackson Configuration

エラー:

WARNING: The following warnings have been detected: WARNING: Contract interface javax.ws.rs.ext.MessageBodyReader can not be registered for component class com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider: Contract not assignable to component. 

のpom.xml(jersey.version 2.22.1を設定するプロパティがある):

<dependency> 
     <groupId>org.glassfish.jersey.containers</groupId> 
     <artifactId>jersey-container-servlet</artifactId> 
     <version>${jersey.version}</version> 
    </dependency> 

    <dependency> 
     <groupId>org.glassfish.jersey.ext</groupId> 
     <artifactId>jersey-spring3</artifactId> 
     <version>${jersey.version}</version> 
     <exclusions> 
      <exclusion> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring</artifactId> 
      </exclusion> 
      <exclusion> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-core</artifactId> 
      </exclusion> 
      <exclusion> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-web</artifactId> 
      </exclusion> 
      <exclusion> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-beans</artifactId> 
      </exclusion> 
      <exclusion> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-context</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>org.glassfish.jersey.media</groupId> 
     <artifactId>jersey-media-json-jackson</artifactId> 
     <version>${jersey.version}</version> 

のweblogic.xml:

<wls:container-descriptor> 
    <wls:prefer-application-packages> 
     <!-- jsr311 --> 
     <wls:package-name>javax.ws.rs.*</wls:package-name> 
     <!-- javassist --> 
     <wls:package-name>javassist.*</wls:package-name> 
     <!-- aop repackaged --> 
     <wls:package-name>org.aopalliance.*</wls:package-name> 
     <!-- jersey 2 --> 
     <wls:package-name>jersey.repackaged.*</wls:package-name> 
     <wls:package-name>org.glassfish.jersey.*</wls:package-name> 
     <wls:package-name>com.sun.research.ws.wadl.*</wls:package-name> 
     <!-- hk2 --> 
     <wls:package-name>org.glassfish.hk2.*</wls:package-name> 
     <wls:package-name>org.jvnet.hk2.*</wls:package-name> 
     <wls:package-name>org.jvnet.tiger_types.*</wls:package-name> 
    </wls:prefer-application-packages> 
    <wls:prefer-application-resources> 
     <wls:resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</wls:resource-name> 
     <wls:resource-name>META-INF/services/javax.ws.rs.ext.RuntimeDelegate</wls:resource-name> 
     <!-- jersey --> 
     <wls:resource-name>META-INF/services/org.glassfish.jersey.*</wls:resource-name> 
     <wls:resource-name>org.glassfish.jersey.*</wls:resource-name> 
     <wls:resource-name>jersey.repackaged.*</wls:resource-name> 
     <!-- hk2 --> 
     <wls:resource-name>META-INF/services/org.glassfish.hk2.*</wls:resource-name> 


     <wls:resource-name>org.codehaus.jackson.*</wls:resource-name> 
     <wls:resource-name>com.fasterxml.jackson.*</wls:resource-name> 
    </wls:prefer-application-resources> 
</wls:container-descriptor> 
+0

このスレッドは面白いです。それは次のような良い関係を持っています:https://stackoverflow.com/questions/45652675/weblogic-12-2-1-2-how-to-tune-the-object-serializer-to-use-jackson-2-and -stran/45654884#45654884 – 99Sono

答えて

1

私のweblogiを変更しました上記のpreferred-application-resourcesセクションにあったパッケージ名com.fasterxml.jackson。*を優先するようにしました。ここに私のweblogic.xmlの抜粋です:

<wls:container-descriptor> 
    <wls:prefer-application-packages> 
     <!-- jsr311 --> 
     <wls:package-name>javax.ws.rs.*</wls:package-name> 
     <!-- javassist --> 
     <wls:package-name>javassist.*</wls:package-name> 
     <!-- aop repackaged --> 
     <wls:package-name>org.aopalliance.*</wls:package-name> 
     <!-- jersey 2 --> 
     <wls:package-name>jersey.repackaged.*</wls:package-name> 
     <wls:package-name>org.glassfish.jersey.*</wls:package-name> 
     <wls:package-name>com.sun.research.ws.wadl.*</wls:package-name> 
     <!-- hk2 --> 
     <wls:package-name>org.glassfish.hk2.*</wls:package-name> 
     <wls:package-name>org.jvnet.hk2.*</wls:package-name> 
     <wls:package-name>org.jvnet.tiger_types.*</wls:package-name> 
     <!--jackson--> 
     <wls:package-name>com.fasterxml.jackson.*</wls:package-name> 
    </wls:prefer-application-packages> 
    <wls:prefer-application-resources> 
     <wls:resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</wls:resource-name> 
     <wls:resource-name>META-INF/services/javax.ws.rs.ext.RuntimeDelegate</wls:resource-name> 
     <!-- jersey --> 
     <wls:resource-name>META-INF/services/org.glassfish.jersey.*</wls:resource-name> 
     <wls:resource-name>org.glassfish.jersey.*</wls:resource-name> 
     <wls:resource-name>jersey.repackaged.*</wls:resource-name> 
     <!-- hk2 --> 
     <wls:resource-name>META-INF/services/org.glassfish.hk2.*</wls:resource-name> 


    </wls:prefer-application-resources> 
</wls:container-descriptor> 
関連する問題