问题描述
场景:在 Mule 4 应用程序中,我们使用了一个 maven 依赖项,比如 MAVEN_DEPENDENCY_APP。 MAVEN_DEPENDENCY_APP 也是一个包含对象存储的 Mule 4 应用程序。运行主应用程序时,出现以下错误:
Caused by: org.mule.runtime.api.exception.MuleRuntimeException: org.mule.runtime.deployment.model.api.DeploymentStartException: Error starting application 'testproject'
Caused by: org.mule.runtime.deployment.model.api.DeploymentStartException: Error starting application 'testproject'
Caused by: org.mule.runtime.api.lifecycle.LifecycleException: Found error when trying to access ObjectStore
Caused by: org.mule.runtime.api.exception.DefaultMuleException: Found error when trying to access ObjectStore
Caused by: org.mule.runtime.extension.api.exception.ModuleException: Found error when trying to access ObjectStore
Caused by: org.mule.runtime.api.store.ObjectStoreException: Could not deserialize object
Caused by: org.mule.runtime.api.serialization.SerializationException: Could not deserialize object
Caused by: org.mule.runtime.api.serialization.SerializationException: Cannot deserialize object
我们尝试在 MAVEN_DEPENDENCY_APP 中的 objectstore 中保存的对象如下:
<ee:transform doc:name="Add id to incoming message" doc:id="32e58163-a06a-414b-84a9-c06768e7733c" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/java
---
{
"message-id" : uuid() as String,"errorPayload" : write(message.payload,"application/java")
}]]></ee:set-payload>
</ee:message>
</ee:transform>
注意:我尝试将 MAVEN_DEPENDENCY_APP 作为 mule 项目运行并对其进行测试。它工作正常。 当我在另一个 mule 4 项目中将该应用程序用作 maven 依赖项时发现问题。
解决方法
尝试更新 objectStore 连接器版本和 runtimeVersion。我过去遇到过类似的问题,我相信已经解决了。
,错误在于打包 mule 应用程序。我使用了 mule-maven-plugin 3.3.5 并提供了以下配置:
<configuration>
<classifier>mule-plugin</classifier>
</configuration>
成功了