Java FailedToCreateRouteException将Camel CDI应用程序部署到Wildfly 8.2

Java FailedToCreateRouteException将Camel CDI应用程序部署到Wildfly 8.2,java,apache-camel,cdi,Java,Apache Camel,Cdi,我正在开发一个应用程序,从卡夫卡队列中读取消息,并对其进行处理,创建电子邮件并发送 我能够在一个独立的java应用程序中使用一个简单的camel路由,但是当我使用CDI和Wildfly 8.2打包它时,它无法部署。 我在这里按照指示行事: 我将该示例用作我的应用程序的模板。 我使用的是Wildfly 8.2.0、Camel 2.18.1、Kafka 0.10.1.1 我做错了什么?我不理解错误“org.apache.camel.FailedToCreateRouteException:未能创建路

我正在开发一个应用程序,从卡夫卡队列中读取消息,并对其进行处理,创建电子邮件并发送

我能够在一个独立的java应用程序中使用一个简单的camel路由,但是当我使用CDI和Wildfly 8.2打包它时,它无法部署。 我在这里按照指示行事: 我将该示例用作我的应用程序的模板。 我使用的是Wildfly 8.2.0、Camel 2.18.1、Kafka 0.10.1.1

我做错了什么?我不理解错误“org.apache.camel.FailedToCreateRouteException:未能创建路由深度电子邮件通知路由:路由(深度电子邮件通知路由)[来自[未提供uri或ref!”…因为必须在:org.apache.camel.impl上指定'uri'或'ref'。DefaultRouteContext@55edcc54"

这是我的大部分代码:

@ApplicationScoped
public class OrderEmailApplication  {

/** The logger. */
private static Logger logger =LogManager.getLogger(OrderEmailRoute.class);

public OrderEmailApplication() {}

@ContextName("OrderNotifications")
static class OrderEmailRoute extends RouteBuilder {

    @Uri("kafka://{{deep.notify.kafka.server}}?topic={{deep.notify.order.topics}}&groupId={{deep.notify.order.groupId}}&"+
                "keyDeserializer=org.apache.kafka.common.serialization.StringDeserializer&" +
                "valueDeserializer=org.apache.kafka.common.serialization.StringDeserializer")
    Endpoint kafkaEndpoint;

    @Uri("file:///home/whomer/tmp/Notify/deadMessages")
    private Endpoint deadLetter;


    @BeanInject
    BulkEmailProcessor bulkEmailProcessor;

    @BeanInject
    FailedMessageEnrichmentProcessor failedEmailEnrichement;


    @Override
    public void configure() throws Exception {
        errorHandler(defaultErrorHandler().maximumRedeliveries(0));

        from(kafkaEndpoint).routeId("Deep-email-notify-route")
        .unmarshal().json(JsonLibrary.Jackson, LinkedHashMap.class)
        .bean("velocityBean")
        .process(bulkEmailProcessor)
        .marshal().json(JsonLibrary.Jackson, Map.class) 
        .to("Log:?level=DEBUG");

        from("direct:getTemplate").to("velocity://dummy");
    }
}

@Named("velocityBean")
static class VelocityBean {
    @Uri("direct:getTemplate")
    private ProducerTemplate template;

    public void process(Exchange exchange) {
        // removed for brevity
    }

}
@Produces
@Named("properties")
// "properties" component bean that Camel uses to lookup properties
PropertiesComponent properties(PropertiesParser parser) {
    PropertiesComponent component = new PropertiesComponent();
    // Use DeltaSpike as configuration source for Camel CDI
    component.setPropertiesParser(parser);
    return component;
}

// PropertiesParser bean that uses DeltaSpike to resolve properties
static class DeltaSpikeParser extends DefaultPropertiesParser {

    @Override
    public String parseProperty(String key, String value, Properties properties) {
        return ConfigResolver.getPropertyValue(key);
    }
}   
}

这是堆栈跟踪:

14:51:37,674 INFO  [org.apache.camel.cdi.CdiCamelExtension] (MSC service thread 1-4) Camel CDI is starting Camel context [OrderNotifications]
14:51:37,680 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC service thread 1-4) Apache Camel 2.18.1 (CamelContext: OrderNotifications) is starting
14:51:37,682 INFO  [org.apache.camel.management.ManagedManagementStrategy] (MSC service thread 1-4) JMX is enabled
14:51:37,821 INFO  [org.apache.camel.impl.DefaultRuntimeEndpointRegistry] (MSC service thread 1-4) Runtime endpoint registry is in extended mode gathering usage statistics of all incoming and outgoing endpoints (cache limit: 1000)
14:51:37,827 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC service thread 1-4) Apache Camel 2.18.1 (CamelContext: OrderNotifications) is shutting down
14:51:37,849 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC service thread 1-4) Apache Camel 2.18.1 (CamelContext: OrderNotifications) uptime 0.169 seconds
14:51:37,849 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC service thread 1-4) Apache Camel 2.18.1 (CamelContext: OrderNotifications) is shutdown in 0.022 seconds
14:51:37,859 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."NotificationService.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."NotificationService.war".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_51]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_51]
Caused by: org.jboss.weld.exceptions.DeploymentException: Exception List with 1 exceptions:
Exception 0 :
org.apache.camel.FailedToCreateRouteException: Failed to create route Deep-email-notify-route: Route(Deep-email-notify-route)[[From[no uri or ref supplied!... because of Either 'uri' or 'ref' must be specified on:      org.apache.camel.impl.DefaultRouteContext@55edcc54
at  org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:201)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:1008)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3397)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3128)
at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:182)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2957)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2953)
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2976)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2953)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2920)
at org.apache.camel.impl.DefaultCamelContext$Proxy$_$$_WeldClientProxy.start(Unknown Source)
at org.apache.camel.cdi.CdiCamelExtension.afterDeploymentValidation(CdiCamelExtension.java:422)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:90)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:271)
at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:121)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:258)
at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:237)
at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:174)
at org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:133)
at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:107)
at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:54)
at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:35)
at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:28)
at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:439)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:93)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Either 'uri' or 'ref' must be specified on: org.apache.camel.impl.DefaultRouteContext@55edcc54
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:136)
at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:69)
at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:90)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1051)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:196)
... 35 more

at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:37)
at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:28)
at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:439)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:93)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
... 3 more
哦,程序员错误! 主要问题是端点注入

而不是 @乌里(“卡夫卡:…”) 终点fubar; 注射应该是:

@端点注入(uri=“kafka:…”) 端点fubar;

面向对象。程序员错误! 主要问题是端点注入

而不是 @乌里(“卡夫卡:…”) 终点fubar; 注射应该是:

@端点注入(uri=“kafka:…”) 终点fubar