【问题标题】:Activemq Not Starting with HTTP uriActivemq 不以 HTTP uri 开头
【发布时间】:2016-08-25 21:41:40
【问题描述】:

我正在使用带有camel的activemq来消费来自队列的消息并将它们发送到http服务器。我正在使用以下骆驼配置:-

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="activemq:queue:Consumer.A.VirtualTopic.Orders"/>
        <to uri="http://localhost:8080/" />
        <!-- <to uri="file:///Users/vinod/activemq.txt"/> -->
        <!-- <to uri="activemq:queue:sssss"/> -->
    </route>
</camelContext>

<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" >
    <property name="connectionFactory">
      <bean class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="vm://localhost?create=false"/>
      </bean>
    </property>
</bean>

在第一个块中创建一个路由,将来自activemq:queue:Consumer.A.VirtualTopic.Orders 的消费者消息排队并将它们发送到http://localhost:8080/ 的服务器。其他两个注释的目的地工作正常,但是当我使用上述配置启动 activemq 以通过 http 发送消息时,服务器停止而不会抛出任何错误消息。 Activemq 日志为 https://gist.github.com/kumar003vinod/1e5944cb246edb74c47fef7a0b433387

请提供一些见解。

【问题讨论】:

    标签: apache-camel activemq


    【解决方案1】:

    确保在 ActiveMQ lib/camel 目录中包含 camel-httpcamel-http-common JAR。您可能还需要在该目录中包含来自 camel-http 的传递依赖项,以便 ActiveMQ 在其类路径中包含所有需要的 JAR。

    这将是 commons-httpclientcommons-codec JAR,但我认为它们已经包含在 lib/optional 中。

    【讨论】:

    • 我已将这些依赖项包含在根目录的 pom.xml 中(请参阅此处的差异 gist.github.com/kumar003vinod/5d50e9c403856ce93dec192bacfab469)。我正在从源代码编译项目。添加这些如果我使用mvn -Dtest=false -DfailIfNoTests=false install 命令构建项目后,这些jar 不会在lib/camel 中创建。查看完整的 pom 文件 gist.github.com/kumar003vinod/f643dbfe4d6b373bfde395c607e5e945。有什么提示吗?
    • 我可以通过在多个 pom 文件中添加依赖项来以某种方式编译它,但是当 activemq 启动时,我不会收到 Ignoring converter type: org.apache.camel.component.http.RequestEntityConverter as a dependent class could not be found: java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEntity | org.apache.camel.impl.converter.AnnotationTypeConverterLoader | main java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEntity 错误。检查gist.github.com/kumar003vinod/ce182c4009de1998f0927a17a5e663bd了解更多信息。
    • 以上问题是因为我没有安装commons-httpclient造成的。安装后它工作正常。
    猜你喜欢
    • 2014-11-17
    • 2013-10-15
    • 1970-01-01
    • 2011-04-09
    • 2018-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多