我自己创建了一个使用 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 工作室项目都包含该库:
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
我的操作类不公开任何采用或返回任何 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);
}
}
我尝试使用程序集插件打包 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}
表明这没有奏效。
任何帮助将不胜感激!
干杯