简体   繁体   中英

Mule error --2 . Failed to invoke method. Message payload is of type string

I have a mule flow that invokes a method and sets the return value in the payload .

Here's the part of my flow that does it

<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 returns a Base64 encoded string .

Here's my stack trace.

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)
********************************************************************************

I'm guessing this is because Mule has a limitation on handling Base64 Strings. As the test cases for the TestUtils class seem to work perfectly fine on their own.

Any insight on what might be happening or possible solutions would be appreciated!

Spring bean from mule flow:

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

Corresponding portion of Java class :

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;
    }
}

The commons codec library included with mule is more older than the one your rsaTokenSigner needs. It doenst contain that method indeed.

I would try to use a classpath override and including the newer library with your application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM