gpt4 book ai didi

java - 在 ActiveMQ 中启动时为 "Camel is shutting down"

转载 作者:行者123 更新时间:2023-11-29 05:29:52 25 4
gpt4 key购买 nike

我目前正在开发一个 Java DSL 路由,它将从 JMS 队列中获取一条消息,对其进行处理,然后使用 JPA 将其放入数据库中。真的很简单:

public void configure() {
from("{{ribMessage.source}}")
.split(xpath("/RibMessages/*"))
.streaming()
.process(new RibMessageToEntityProcessor())
.to("{{ribMessage.destination}}");
}

如您所见,我在这里尝试使用 camel 属性,我已在类路径的属性文件中定义了这些属性:

ribMessage.source=activemq:queue:in.item_q
ribMessage.destination=jpa:com.axstores.aim.entities.XMLImport

属性文件在spring中是这样定义的:

<bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent">
<property name="location" value="classpath:ribmessage.properties"/>
</bean>

我已更新 activemq 配置以包含 camel.xml,并将我的路由包添加到 ActiveMQ camel.xml。在启动期间,ActiveMQ 正在寻找我的路线,但它似乎无法找到我的属性(property),而是查找 URI {{ribMessage.source}}。这当然会失败,日志中的下一行显示 Camel 正在关闭。

2014-02-01 23:31:20,278 | DEBUG | Searching for implementations of org.apache.camel.RoutesBuilder in packages: [com.axstores.aim] | org.apache.camel.impl.DefaultPackageScanClassResolver | main
2014-02-01 23:31:20,374 | DEBUG | Found: [class com.axstores.aim.routes.RibMessageToAimRoute] | org.apache.camel.impl.DefaultPackageScanClassResolver | main
...
2014-02-01 23:46:52,410 | TRACE | Starting service | org.apache.camel.support.ServiceSupport | main
2014-02-01 23:46:52,414 | TRACE | Getting endpoint with uri: {{ribMessage.source}} | org.apache.camel.spring.SpringCamelContext | main
2014-02-01 23:46:52,416 | INFO | Apache Camel 2.12.1 (CamelContext: camel) is shutting down | org.apache.camel.spring.SpringCamelContext | main

我怀疑我的配置中遗漏了一些东西,因为在我看来我的 spring 配置文件根本没有被读取。

有什么线索吗?需要更多信息?

Full log for reference

Spring config

最佳答案

您需要将 camel-jpa 组件 JAR 添加到 ActiveMQ 代理的类路径中。以及 JPA 可能需要的其他 JAR,例如 JPA 实现和 JDBC 驱动程序等等。

关于java - 在 ActiveMQ 中启动时为 "Camel is shutting down",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21504764/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com