Camel和Quartz2以及一些机器出现了奇怪的问题

时间:2018-03-23 14:57:13

标签: java spring apache-camel quartz

我有一个带有以下Camel Route的WAR文件:

Expected value to equal:
  false
Received:
  true

  at Object.<anonymous> (__tests__/unit/components/create/MyComponent-test.js:90:37)
      at new Promise (<anonymous>)
      at <anonymous>
  at process._tickCallback (internal/process/next_tick.js:118:7)

它使用Camel 2.20和Camel Quartz2。以下是POM文件中的依赖项。

qtz.expression read from property file and set value as: 0/30+*+*+*+*+?

    from("quartz2://schedulerVigenciaClienteEnvase?cron={{qtz.expression}}")
            .handleFault()
            .log("Testing job")
            .process("testProcessor");

问题在于使用相同Java版本的某些机器在每个Quartz触发时刻产生以下异常。

<dependencies>
    <!-- ${camel.version} contains 2.20.2 value -->
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
       <version>${camel.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-spring</artifactId>
      <version>${camel.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-servlet</artifactId>
      <version>${camel.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-quartz2</artifactId>    
      <version>${camel.version}</version>   
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-jms</artifactId>
        <version>${camel.version}</version>
    </dependency>  
</dependencies>

java.lang.NoSuchMethodError:org.apache.camel.impl.DefaultMessage。(Lorg / apache / camel / CamelContext;)V

为什么该方法不会在所有机器中抱怨,使用相同的JVM版本和操作系统。

任何建议都表示赞赏。

1 个答案:

答案 0 :(得分:0)

发现问题和解决方案,在我们使用ActiveMQ的项目中,有一个名为 activemq-all 的依赖项,里面包含一个在类加载时发生冲突的内部Camel实现(有时,不总是)。最终解决方案是使用以下列表替换此依赖项:

<!-- Apache Active MQ Jars -->
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-broker</artifactId>
        <version>${activemq.version}</version>     
    </dependency>
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-client</artifactId>
        <version>${activemq.version}</version>     
    </dependency>
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-pool</artifactId>
        <version>${activemq.version}</version>      
    </dependency>
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-camel</artifactId>
        <version>${activemq.version}</version>      
    </dependency>