有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java找不到名为“myProcessor”的bean的类[net.ab.cd.myProcessor.myProcessor],嵌套异常为ClassNotFoundException

我正在使用apache camel发送/接收MyProcessor类中的exchange属性,该类由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
    }
}

我的camel 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) 个答案