Search code examples
javaapache-camelactivemq-classicapache-karaf

Camel-activemq component inside of karaf


Karaf 4.4.3, camel 3.20.5 I have a blueprint with

    <bean id="activemq" class="org.apache.camel.component.activemq.ActiveMQComponent">
        <property name="brokerURL" value="tcp://localhost:61616" />
        <property name="username" value="karaf" />
        <property name="password" value="karaf" />
    </bean>

I get error when I try to start my app inside of karaf:

org.osgi.service.blueprint.container.ComponentDefinitionException: Error when instantiating bean activemq of class org.apache.camel.component.activemq.ActiveMQComponent
...
Caused by: java.lang.NoClassDefFoundError: javax/jms/JMSContext
...
Caused by: java.lang.ClassNotFoundException: javax.jms.JMSContext not found by org.apache.geronimo.specs.geronimo-jms_1.1_spec [203]

My features:

        <feature>transaction</feature>
        <feature>jndi</feature>
        <feature>pax-jdbc-config</feature>
        <feature>pax-jdbc-postgresql</feature>
        <feature>pax-jdbc-pool-dbcp2</feature>
        <feature>jdbc</feature>
        <feature>jms</feature>
        <feature>activemq-client</feature>
        <feature>pax-jdbc</feature>
        <feature dependency="true">aries-blueprint</feature>
        <feature>cxf</feature>
        <feature>camel-activemq</feature>

I've also tried initializing ActiveMQConnectionFactory but was getting same NoClassDeffound error. Also tried installing bundle:install mvn:javax.jms/javax.jms-api/2.0.1, but that didn't help.

I'm guessing there is some API mismatch or I'm missing a dependency.

Without the ActiveMQComponent the bundle was working fine.

The activemq broker is inside the same karaf instance, I'm connecting to it via hawtio with no issues.


Solution

  • That component is wired to JMS 2.0 API jar. You need to change your feature to install a javax.jms-api jar that is 2.0 and not the geronimo-jms-api jar that supports JMS v1.1