如何解决Mule SDK 插件导致 java.lang.NoClassDefFoundError: org/json/JSONObject
我自己创建了一个使用 JSON 库的插件。该项目在 IntelliJ 和控制台中构建、运行和测试。
当我将插件导入 Anypoint Studio 时,出现此错误:
ERROR 2021-06-04 06:41:34,587 [[MuleRuntime].uber.01: [p-buchzentrum].get:\delays:p-buchzentrum-config.BLOCKING @2eb68d5] [processor: p-buchzentrum-implementationSub_Flow1/processors/4; event: 23dce8c1-c4ef-11eb-96c7-00e04c682392] org.mule.runtime.core.internal.exception.OnCriticalErrorHandler:
********************************************************************************
Message : java.lang.NoClassDefFoundError: org/json/JSONObject
Element : p-buchzentrum-implementationSub_Flow1/processors/4 @ p-buchzentrum:p-buchzentrum-implementation.xml:22 (Write)
Element DSL : <bookit:write doc:name="Write" doc:id="1b4c08ce-1f90-459b-821d-78ad2a4f0f19" payload="#[payload]"></bookit:write>
Error type : MULE:FATAL_JVM_ERROR
FlowStack : at p-buchzentrum-implementationSub_Flow1(p-buchzentrum-implementationSub_Flow1/processors/4 @ p-buchzentrum:p-buchzentrum-implementation.xml:22 (Write))
at get:\delays:p-buchzentrum-config(get:\delays:p-buchzentrum-config/processors/0 @ p-buchzentrum:p-buchzentrum.xml:130 (Flow Reference))
at p-buchzentrum-main(p-buchzentrum-main/processors/0 @ p-buchzentrum:p-buchzentrum.xml:17)
(set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
ERROR 2021-06-04 06:41:34,597 [[MuleRuntime].uber.01: [p-buchzentrum].get:\delays:p-buchzentrum-config.BLOCKING @2eb68d5] [processor: p-buchzentrum-implementationSub_Flow1/processors/4; event: 23dce8c1-c4ef-11eb-96c7-00e04c682392] org.mule.runtime.core.internal.exception.OnCriticalErrorHandler:
********************************************************************************
Message : java.lang.NoClassDefFoundError: org/json/JSONObject
Element : (None)
Element DSL : (None)
Error type : MULE:FATAL_JVM_ERROR
FlowStack : (None)
我的插件和我的 Anypoint Studio 项目都包含该库:
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
My Operations 类不公开任何采用或返回任何 JSONObjects 的方法:
public class BookitOperations {
@MediaType(value = ANY,strict = false)
public String read(String payload) {
return FileHandler.read(payload);
}
@MediaType(value = ANY,strict = false)
public String write(String payload) {
return FileHandler.write(payload);
}
}
我尝试使用 assembly-plugin 打包 maven 依赖项:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
但是使用以下命令解压插件:
jar xf {my-connector.jar}
表明这不起作用。
如有任何帮助,我们将不胜感激!
干杯
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。