我正在使用Apache骆驼在MyProcessor类中发送/接收交换属性,该类是由Processor接口实现的:
package net.ab.cd.myProcessor
public class MyProcessor implements Processor {
@Override
void process(Exchange exchange) throws Exception {
//logic to accept and send exchange properties
}
}
我的骆驼xml看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-
beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="myProcessor" class="net.ab.cd.myProcessor.MyProcessor"/>
<camelContext id="mainContext" xmlns="http://camel.apache.org/schema/spring">
<route id="route1">
<from uri="direct:start"/>
<to uri="bean:myProcessor"/>
<to uri="bean:varpop?method=moveToOutboundVariables('statusResponse')"/>
</route>
</camelContext>
我已经建立了我的班级项目,以便使用shadowJar重新定位我的包:
group = "net.ab.cd"
shadowJar {
relocate("${project.group}", "${project.group}.myProcessor.shadow") {
exclude "${project.group}.myProcessor.*"
}
}
但是最后我遇到了这个错误,并且找不到我的班级: 找不到名称为'myProcessor'的bean的类[net.ab.cd.myProcessor.MyProcessor]嵌套异常为java.lang.ClassNotFoundException