找不到名称为'myProcessor'的bean的类[net.ab.cd.myProcessor.myProcessor]嵌套异常为ClassNotFoundException

时间:2019-09-10 11:31:49

标签: java spring gradle apache-camel

我正在使用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(&apos;statusResponse&apos;)"/>
    </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

0 个答案:

没有答案