如何解决在mule 4中使用缓存作用域时无法序列化对象导致的错误

如何解决在mule 4中使用缓存作用域时无法序列化对象导致的错误,mule,mule-component,mulesoft,mule4,Mule,Mule Component,Mulesoft,Mule4,我在流中添加了缓存作用域,用于响应http请求。在缓存作用域之前,我有一个set变量组件,其中包含json对象,因为我得到了一个错误。当我移除 设置变量,它正在工作。即使使用set变量,如何解决该问题 错误: com.mulesoft.mule.runtime.cache.internal.ObjectStoreCachingStrategy: Unable to store event in cache org.mule.runtime.api.store.ObjectStoreExcep

我在流中添加了缓存作用域,用于响应http请求。在缓存作用域之前,我有一个set变量组件,其中包含json对象,因为我得到了一个错误。当我移除 设置变量,它正在工作。即使使用set变量,如何解决该问题

错误:

 com.mulesoft.mule.runtime.cache.internal.ObjectStoreCachingStrategy: Unable to store event in cache
 org.mule.runtime.api.store.ObjectStoreException: Could not serialize object Caused by: 
 org.mule.runtime.api.serialization.SerializationException: Could not serialize object 
流量:

<flow name="tokenFlow" doc:id="cb6d9de3-45fa-47f0-b2f5-875048d0b980" ><http:listener doc:name="Listener" doc:id="36c16957-47c1-4d07-b6c2-694e6c86a9f3" config-ref="HTTP_Listener_config" path="/fssvc-api/collectionSFDCInbound"/>
    <set-variable value="#[payload]" doc:name="Set Variable" doc:id="3f372591-b02a-4d82-a634-159b865090ca" variableName="request" />
    <ee:cache doc:name="Cache" doc:id="ae4c75b2-5e92-4578-9966-1277b47b472a" cachingStrategy-ref="Caching_Strategy1">
        <http:request method="POST" doc:name="Request" doc:id="08d40c87-8f60-4b4e-8e20-1c93c1b52477" config-ref="HTTP_Request_configuration" url="https://idfcfirstbank--colqaorg.my.salesforce.com/services/oauth2/token?">
        <http:query-params><![CDATA[#[output
  application/java
   ---
 {
"password" : "test",
"grant_type" : "password",
"client_secret" : "test1234",
"client_id" : "1234",
"username" : "test@gmail.com"
}]]]></http:query-params>
    </http:request>
    </ee:cache>
</flow>

知识库文章中描述了该问题

正如它所解释的,您可以将变量转换为字符串以避免序列化问题

例如:

<set-variable value="#[output application/java --- payload as String]" ...>


自Mule 4.3.0以来,缓存中存储的信息范围已经缩小,因此将Mule的版本迁移到最后一个版本是一个解决方案。

Hi@aled这种方法面临的一个问题是长值正在转换为双值。我可以避免吗?你应该问一个新问题。我也面临同样的问题。根据我最近的经验,KB文章并没有提出一个明确的解决方案(这是一个猜测游戏),这个问题是在mulesoft支持的4.3运行时解决的(获得了我的运行时4.2.2的补丁)。它对我有用