【问题标题】:Apache Camel JUnit test warningsApache Camel JUnit 测试警告
【发布时间】:2012-03-14 03:57:53
【问题描述】:

我正试图弄清楚如何摆脱在我的 JUnit 测试中出现的警告。该测试扩展了 CamelTestSupport,但所有测试方法都抛出

WARN : Caught unhandled exception while processing ExchangedId:...

java.lang.IllegalArgumentException: connectionFactory must be specified

任何想法如何解决这个问题?

【问题讨论】:

  • 你能发布你的整个单元测试吗?可能只是缺少 JMS connectionFactory 设置,请参阅camel.apache.org/jms.html

标签: java junit apache-camel


【解决方案1】:

如果您使用的是 JMS/AMQ,那么您可能需要添加它来设置您的组件/connectionFactory...

protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    String url = "vm://test-broker?broker.persistent=false&broker.useJmx=false";
    ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url);
    camelContext.addComponent("activemq", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
    return camelContext;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-06-12
    • 2018-07-29
    • 1970-01-01
    • 1970-01-01
    • 2023-03-05
    • 1970-01-01
    • 2017-03-25
    • 1970-01-01
    相关资源
    最近更新 更多