Search code examples
javaapache-camelactivemq-classicqpid

Camel AMQP - AMQConnectionFactory ClassNotFound


I'm using Camel 2.13.3 and trying to establish a connection via AMQP to a remote ActiveMQ instance.

According to the Camel AMQP docs is should be sufficient to add the following dependency

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-amqp</artifactId>
    <version>2.13.1</version> 
</dependency>

It then indicates that you should configure the jms component to use a connection factory supplied by the QPID project. The docs page uses org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl, and the results of other google searches indicate that org.apache.qpid.client.AMQConnectionFactory could be used.

However, the org.apache.qpid dependencies do not appear to have been added to the project and, unsurprisingly, I get a ClassNotFoundException when I run it.

I considered downloading the qpid dependency separately, but their web site seems to indicate that the qpid client project has been deprecated and replaced by something else ( QPID Messaging API if I remember correctly )

Can anyone point me in the right direction?


Solution

  • should be sufficient

    The Camel docs you linked to does not state that. It just says this dependency is needed, doesn't say anything about additional dependencies. Just looked inside the jar you're using, and it does not contain qpid-client classes. You should add that dependency to your pom as well. For AMQP 0.x, there is a good chance you'll need JMS spec dependency as well:

    <dependency>
      <groupId>org.apache.qpid</groupId>
      <artifactId>qpid-client</artifactId>
      <version>0.32</version> <!-- replace with appropriate version -->
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-jms_1.1_spec</artifactId>
      <version>1.0</version>
    </dependency>
    

    If you're using AMQP 1.0,

    <dependency>
      <groupId>org.apache.qpid</groupId>
      <artifactId>qpid-jms-client</artifactId>
      <version>0.3.0</version>
    </dependency>