メソッドを呼び出してペイロードに戻り値を設定するミュール フローがあります。
これが私のフローの一部です
<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
それ自体で完全に機能するようです。
何が起こっているのか、または可能な解決策についての洞察をいただければ幸いです。
ラバの流れからの春豆:
<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;
}
}