java - 无法解析 org.apache.camel.impl.HeaderFilterStrategyComponent 类型

标签 java maven apache-camel

我在 Camel 应用程序中遇到以下问题:

The project was not built since its build path is incomplete. Cannot find the class file for org.apache.camel.impl.HeaderFilterStrategyComponent. Fix the build path then try building this project camel

public class SendMessageToActiveMq {
   public static void main(String[] args) throws Exception { 
    ConnectionFactory factory = new ActiveMQConnectionFactory();
    CamelContext context = new DefaultCamelContext();
    context.addComponent("jms", JmsComponent.jmsComponentAutoAcknowledge(factory));
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  }
}

这是我的 Maven pom 依赖项:

   <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-camel</artifactId>
        <version>5.15.11</version>
    </dependency>

注意: 它确实适用于camel-core 2.24.2。为什么它不能与 3.0.0 一起使用?有什么替代方案吗?

最佳答案

根据 Camel 3 migration guide 。 activemq-camel 组件已移至 Apache Camel 代码库。更新您的依赖项,例如:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-activemq</artifactId>
    <version>3.0.0</version>
</dependency>

关于java - 无法解析 org.apache.camel.impl.HeaderFilterStrategyComponent 类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59290279/

相关文章:

java - 解析 xml : attributes. getValue() 返回 null?

java - equals() 没有给出预期结果

java - 使用属性在 arraylist 中创建新对象

grails - 控制 Camel 路线的启动和关闭

java - 将 CSV 转换为字符串的正则表达式代码

java - 如何将带有类的 JAR 文件分发给其他开发人员?

java maven制作jar : Could not find or load main class

maven - 让 Gradle 使用本地 Maven 存储库中的 Artifact

filter - 如何在 apache camel 中过滤消息

apache-camel - Apache camel cxf 端点 - 指定 http(s) 代理?