简体   繁体   English

Camel和Quartz2和某些机器的奇怪故障

[英]Strange trouble with Camel and Quartz2 and some machines

I have a WAR file with the following Camel Route: 我有一个带有以下骆驼路线的WAR文件:

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

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

It uses Camel 2.20, and Camel Quartz2. 它使用Camel 2.20和Camel Quartz2。 The following are the dependencies inside the POM file. 以下是POM文件中的依赖项。

<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>

The trouble is in some machines using the same Java version produces the following exception each Quartz triggering moment. 问题是在某些使用相同Java版本的机器上,每个Quartz触发时刻都会产生以下异常。

2018-03-22 18:54:00,005 JobRunShell ERROR Job Camel_camel-1.schedulerVigenciaClienteEnvase threw an unhandled Exception: 
**java.lang.NoSuchMethodError: org.apache.camel.impl.DefaultMessage.<init>(Lorg/apache/camel/CamelContext;)V**
    at org.apache.camel.component.quartz2.QuartzMessage.<init>(QuartzMessage.java:33) ~[camel-quartz2-2.20.2.jar:2.20.2]
    at org.apache.camel.component.quartz2.CamelJob.execute(CamelJob.java:57) ~[camel-quartz2-2.20.2.jar:2.20.2]
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-2.3.0.jar:?]
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.3.0.jar:?]
2018-03-22 18:54:00,006 ErrorLogger                    ERROR Job (Camel_camel-1.schedulerVigenciaClienteEnvase threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.
    at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [quartz-2.3.0.jar:?]
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) **[quartz-2.3.0.jar:?]**
**Caused by: java.lang.NoSuchMethodError: org.apache.camel.impl.DefaultMessage.<init>(Lorg/apache/camel/CamelContext;)V
    at org.apache.camel.component.quartz2.QuartzMessage.<init>**(QuartzMessage.java:33) ~[camel-quartz2-2.20.2.jar:2.20.2]
    at org.apache.camel.component.quartz2.CamelJob.execute(CamelJob.java:57) ~[camel-quartz2-2.20.2.jar:2.20.2]
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[quartz-2.3.0.jar:?]

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

Why the method are not complaining in all the machines, using same JVM version and OS. 为什么在使用相同JVM版本和OS的所有机器上都无法使用该方法。

Any suggestions are appreciated. 任何建议表示赞赏。

Found the problem and the solution, in the project we are using ActiveMQ, so, there was a dependency called activemq-all , that inside includes an internal Camel implementation that collides at classloading (sometimes, not always). 找到了问题和解决方案后,在我们使用ActiveMQ的项目中,有一个名为activemq-all的依赖项,该依赖项包含一个内部Camel实现,该实现在类加载时发生冲突(有时,并非总是如此)。 Final solution was replacing this dependency with the following list: 最终解决方案是使用以下列表替换此依赖项:

<!-- 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> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM