You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Saravanakumar Murugesan <SM...@advaoptical.com> on 2017/04/04 13:14:17 UTC

: No Class Def Found Error - org/apache/activemq/broker/BrokerService

I have created a messagingserver bundle and I am trying to start activemq broker from that bundle.  messagingserver bundle depends on activemq-broker bundle.

I have added below dependency in messagingserver feature;

<bundle>wrap:mvn:org.apache.activemq/activemq-broker/5.14.3$Bundle-Version=5.14.3&Bundle-SymbolicName=activemq-broker-bundle&Export-Package=*;version=5.14.3</bundle>

Below code cnippet is used to start activemq broker.

BrokerService brokerService = new BrokerService()
brokerService.addConnector("tcp://" + hostIpaddress + ":61616");
brokerService.start();

activemq-broker is deployed correctly and it has org.apache.activemq.broker.BrokerService class. That bundle is also exporting org.apache.activemq.broker. bundle:classes list BrokerService class.

root>bundle:list | grep -i activemq
335 | Active      |  80 | 5.14.3                             | activemq-broker-bundle
336 | Active      |  80 | 5.14.3                             | activemq-client
root>

Export-Package =
        org.apache.activemq.advisory;
                uses:="org.apache.activemq.broker,
                        org.apache.activemq.broker.region,
                        org.apache.activemq.broker.region.virtual,
                        org.apache.activemq.command,
                        org.apache.activemq.usage";
                version=5.14.3,
        org.apache.activemq.broker;

messagingserver bundle is importing org.apache.activeme.broker correctly.

messagingserver-impl (340)
--------------------------
Import-Package =
        com.google.gson;version="[2.3,3)",
        javax.jms;version="[1.1,2)",
        org.apache.activemq;version="[5.14,6)",
        org.apache.activemq.broker;version="[5.14,6)",
        org.opendaylight.controller.md.sal.binding.api;version="[1.4,2)",
        org.osgi.framework;version="[1.7,2)",
        org.osgi.framework.wiring;version="[1.1,2)",
        org.slf4j;version="[1.7,2)"

On starting server, below exception is thrown

Caused by: java.lang.NoClassDefFoundError: org/apache/activemq/broker/BrokerService
        at com.adva.ensemble.controller.messagingserver.service.ActiveMQMessagingServer.startActiveMQServer(ActiveMQMessagingServer.java:37)
        at com.adva.ensemble.controller.messagingserver.service.ActiveMQMessagingServer.init(ActiveMQMessagingServer.java:30)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_77]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_77]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_77]
        at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_77]
        at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:299)
        at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:980)
        at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:736)
        ... 39 more
Caused by: java.lang.ClassNotFoundException: org.apache.activemq.broker.BrokerService
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:455)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_77]

Any other configuration needs to be done to integrate activemq in my server? I think I have added the depenendency correctly, but still it thrown NoClassDefFoundError