2016-07-21 11 views
0

MSF4Jを使用してマイクロサービスを開発しようとしています。このサービスは、入力要求のヘッダーの詳細を取得し、それ以降の操作のためにSOAPサービスと通信しようとします。通常のアプリケーションのように書かれたこのロジックが正常に動作しますが、それは例外SOAPサービスと通信しようとするMSF4Jマイクロサービス

[org.apache.axis2.context.AbstractContext] : OnDemandLogger initialized for class org.apache.axis2.context.AbstractContext is:[email protected] 
[org.apache.axis2.util.Loader] : Trying to find [org/apache/axis2/deployment/axis2_default.xml] using [email protected] class loader. 
2016-07-21 17:45:48 ERROR ChannelChunkResponder:103 - Resource method threw an exception 
java.lang.reflect.InvocationTargetException 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.wso2.msf4j.internal.router.HttpMethodInfo.invoke(HttpMethodInfo.java:95) 
    at org.wso2.msf4j.internal.router.HttpDispatcher.channelRead0(HttpDispatcher.java:53) 
    at org.wso2.msf4j.internal.router.HttpDispatcher.channelRead0(HttpDispatcher.java:31) 
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308) 
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294) 
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308) 
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294) 
    at org.wso2.msf4j.internal.router.RequestRouter.channelRead0(RequestRouter.java:83) 
    at org.wso2.msf4j.internal.router.RequestRouter.channelRead0(RequestRouter.java:44) 
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308) 
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294) 
    at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308) 
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294) 
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) 
    at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308) 
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294) 
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:244) 
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308) 
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294) 
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846) 
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) 
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) 
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) 
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) 
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) 
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:110) 
    at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) 
    at java.lang.Thread.run(Unknown Source) 
Caused by: java.lang.NoSuchMethodError: org.apache.axiom.om.OMAbstractFactory.getMetaFactory()Lorg/apache/axiom/om/OMMetaFactory; 
    at org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(OMXMLBuilderFactory.java:87) 
    at org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(OMXMLBuilderFactory.java:73) 
    at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:590) 
    at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:575) 
    at org.apache.axis2.deployment.DescriptionBuilder.buildOM(DescriptionBuilder.java:97) 
    at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:91) 
    at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:887) 
    at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:116) 
    at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64) 
    at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:210) 
    at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:150) 
    at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:143) 
    at org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub.<init>(OAuth2TokenValidationServiceStub.java:103) 
    at org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub.<init>(OAuth2TokenValidationServiceStub.java:89) 
    at com.wipro.oauth.manager.IDManagementClient.validateToken(IDManagementClient.java:220) 
    at com.wipro.oauth.manager.IdentityServerRest.getOAuthToken(IdentityServerRest.java:126) 
    ... 37 more 

SOAPサービス次をスローmicroserviceに変換されたとき、microserviceはWSO2アイデンティティサーバーの「OAuth2TokenValidationService」であると通信しようとします。 microserviceに通常のアプリケーションの変換中に、次の依存関係が追加されている

public OAuth2TokenValidationResponseDTO validateToken(
       String accessTokenIdentifier) 
       throws RemoteException, LoginAuthenticationExceptionException { 


      OAuth2TokenValidationServiceStub stub = new OAuth2TokenValidationServiceStub(
        null, server 
          + "/services/OAuth2TokenValidationService"); 

      ServiceClient e3 = stub._getServiceClient(); 
      Options option3 = e3.getOptions(); 
      HttpTransportProperties.Authenticator auth1 = new HttpTransportProperties.Authenticator(); 
      auth1.setUsername(utUsername); 
      auth1.setPassword(utPassword); 
      auth1.setPreemptiveAuthentication(true); 
      option3.setManageSession(true); 
      /*option2.setProperty(Constants.Configuration.MESSAGE_TYPE,HTTPConstants.MEDIA_TYPE_APPLICATION_ECHO_XML); 
      option2.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION,Boolean.TRUE);*/ 
      option3.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth1); 
      /*option2.setProperty("Cookie", authCookie);*/ 
      e3.setOptions(option3); 

      OAuth2TokenValidationRequestDTO oauthReq = new OAuth2TokenValidationRequestDTO(); 

      OAuth2TokenValidationRequestDTO_OAuth2AccessToken accessToken = new OAuth2TokenValidationRequestDTO_OAuth2AccessToken(); 
      accessToken.setTokenType("Bearer"); 
      accessToken.setIdentifier(accessTokenIdentifier); 
      oauthReq.setAccessToken(accessToken); 
      oauthReq.setRequiredClaimURIs(null); 

      OAuth2TokenValidationResponseDTO resp = stub.validate(oauthReq); 


return resp; 
    } 

を次のように

ザがSAOPサービスへの呼び出しを組み込む方法があります。 AXIOMに関連

<dependency> 
      <groupId>org.wso2.carbon</groupId> 
      <artifactId>org.wso2.carbon.transport</artifactId> 
      <version>5.0.0-alpha</version> 
      <exclusions> 
       <exclusion> 
        <groupId>org.slf4j</groupId> 
        <artifactId>slf4j-api</artifactId> 
       </exclusion> 
      </exclusions> 
     </dependency> 

依存関係

<dependency> 
        <groupId>org.apache.ws.commons.axiom.wso2</groupId> 
        <artifactId>axiom</artifactId> 
        <version>1.2.11.wso2v4</version> 
       </dependency> 
    <dependency> 
     <groupId>org.apache.woden</groupId> 
     <artifactId>woden-impl-dom</artifactId> 
     <version>1.0M8</version> 
</dependency> 

この問題を解決するためのすべてのヘルプは大歓迎されますされています。

答えて

1

最新のMSF4J 2.0リリースをお試しください。

この問題の根本的な原因は次のとおりです。原因:java.lang.NoSuchMethodError:org.apache.axiom.om.AbstractFactory.getMetaFactory()Lorg/apache/axiom/om/OMMetaFactory;

これが意味するのは、依存関係ツリーではおそらく別のバージョンのAxiomが推移的な依存関係として取り込まれているということです。

実行; mvn dependency:ツリーを開き、Axiomの他のバージョンが取り込まれ、Mavenビルドからこれらのバージョンが除外されているかどうかを調べます。

関連する問題