【问题标题】:Mule error --2 . Failed to invoke method. Message payload is of type string骡错误--2。调用方法失败。消息负载是字符串类型
【发布时间】:2014-12-06 02:08:28
【问题描述】:

我有一个 mule 流,它调用一个方法并在 payload 中设置返回值。

这是我的流程的一部分

<flow name="PositiveFlow1" doc:name="PositiveFlow1">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="9293" doc:name="HTTP"/>
         <invoke object-ref="TestUtils1"
        method="getSignedClaimWrapper"
        doc:name="Invoke"/>
        <set-session-variable variableName="clientcontext" value="#[payload]" doc:name="Session Variable"/>
        <flow-ref name="_subflow1" doc:name="Flow Reference"/>
    </flow>

getSignedClaimWrapper 返回一个 Base64 编码字符串。

这是我的堆栈跟踪。

Message               : Failed to invoke com.test.TestUtils@2cfe109a. Message payload is of type: String
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString([B)Ljava/lang/String; (java.lang.NoSuchMethodError)
  com.nimbusds.jose.util.Base64URL:64 (null)
2. Failed to invoke com.test.TestUtils@2cfe109a. Message payload is of type: String (org.mule.api.MessagingException)
  org.mule.processor.InvokerMessageProcessor:178 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString([B)Ljava/lang/String;
    at com.nimbusds.jose.util.Base64URL.encode(Base64URL.java:64)
    at com.nimbusds.jose.util.Base64URL.encode(Base64URL.java:91)
    at com.nimbusds.jose.Header.toBase64URL(Header.java:238)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

我猜这是因为 Mule 在处理 Base64 字符串方面存在限制。由于TestUtils 类的测试用例本身似乎工作得很好。

任何关于可能发生的事情或可能的解决方案的见解将不胜感激!

来自 mule 流的 Spring bean:

    <spring:bean id="TestUtils1"   class="com.package.TestUtils"/>    
</spring:beans>

Java类的对应部分:

public String getSignedClaimWrapper() throws KeyLoadException,
    KeyNotFoundException, SignException, SignerNotInitializedException
    {

        String signedClaim = rsaTokenSigner.signClaim(claimsSet);// returns a base64 encoded string.

        System.out.println("The signed claim is " + signedClaim);
        return signedClaim;
    }
}

【问题讨论】:

  • 你能显示java类和你试图调用的方法吗?还有Mule config中的spring bean ??

标签: java mule mule-el mule-component


【解决方案1】:

mule 包含的公共编解码器库比您的 rsaTokenSigner 需要的更旧。它确实不包含该方法。

我会尝试使用 classpath override 并在您的应用程序中包含较新的库。

【讨论】:

  • 感谢您的回答。但是您的意思是阻止而不是覆盖?
  • 没有帮助。覆盖不会改变任何东西,阻塞会抛出ClassNotFoundException
  • 屏蔽后,您是将该库添加到您的应用还是添加到 lib/user 中?
  • 我将它添加到 pom.xml 中。我正在从 Eclipse 中处理它。那我在哪里添加呢?
  • 你是什么意思,普通的eclipse还是studio?您是作为 maven 还是作为普通应用程序运行它?就我个人而言,在尝试使其在 eclipse/studio 中工作之前,我会测试手动部署到容器。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多