Error while using rabbit mq client in an ODL application?

asked 2014-09-29 08:50:24 -0700

gyanesh gravatar image

updated 2014-09-29 09:05:09 -0700

I have a rabbit mq server out side of ODL. I need to use rabbit mq client inside ODL in an application so that i can send message to the server.

I put the dependency in pom.xml file, also i have imported the rabbitmq client packages in my file. But i get below error: sgi> start 176 gogo: BundleException: The bundle "org.opendaylight.openflowplugin.test-app0.0.3.SNAPSHOT [176]" could not be resolved. Reason: Missing Constraint: Import-Package: com.rabbitmq.client; version="[3.3.0,4.0.0)" osgi> diag 176 file:/Users/distribution/base/target/distributions-openflowplugin-base-0.0.3-SNAPSHOT-osgipackage/opendaylight/plugins/test-app-0.0.3-SNAPSHOT.jar [176] Direct constraints which are unresolved: Missing imported package com.rabbitmq.client[3.3.0,4.0.0). osgi>

The pom.xml file is: <dependency> <groupid>com.rabbitmq</groupid> <artifactid>amqp-client</artifactid> <version>3.3.5</version> </dependency>

the java file: import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.Connection; import com.rabbitmq.client.Channel;

OSGi error:

sgi> !ENTRY org.opendaylight.openflowplugin.test-app 4 0 2014-09-29 13:02:43.649 !MESSAGE FrameworkEvent ERROR !STACK 0 org.osgi.framework.BundleException: State change in progress for bundle "file:/Users/mac/Documents/Project/openflowplugin/distribution/base/target/distributions-openflowplugin-base-0.0.3-SNAPSHOT-osgipackage/opendaylight/plugins/test-app-0.0.3-SNAPSHOT.jar" by thread "fileinstall-./plugins". at org.eclipse.osgi.framework.internal.core.AbstractBundle.beginStateChange(AbstractBundle.java:1088) at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.suspendBundle(PackageAdminImpl.java:330) at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.processDelta(PackageAdminImpl.java:467) at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.doResolveBundles(PackageAdminImpl.java:251) at org.eclipse.osgi.framework.internal.core.PackageAdminImpl$1.run(PackageAdminImpl.java:174) at java.lang.Thread.run(Thread.java:744) Caused by: org.eclipse.osgi.framework.internal.core.AbstractBundle$BundleStatusException ... 6 more Root exception: org.eclipse.osgi.framework.internal.core.AbstractBundle$BundleStatusException at org.eclipse.osgi.framework.internal.core.AbstractBundle.beginStateChange(AbstractBundle.java:1088) at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.suspendBundle(PackageAdminImpl.java:330) at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.processDelta(PackageAdminImpl.java:467) at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.doResolveBundles(PackageAdminImpl.java:251) at org.eclipse.osgi.framework.internal.core.PackageAdminImpl$1.run(PackageAdminImpl.java:174) at java.lang.Thread.run(Thread.java:744) 2014-09-29 13:02:43.652 BRT [org.opendaylight.controller.logging.bridge.internal.LogListenerImpl@1285b0b9] ERROR o.o.c.logging.bridge.OSGI2SLF4J - Bundle:org.opendaylight.openflowplugin.test-app Message:FrameworkEvent ERROR org.osgi.framework.BundleException: State change in progress for bundle "file:/Users/mac/Documents/Project/openflowplugin/distribution/base/target/distributions-openflowplugin-base-0.0.3-SNAPSHOT-osgipackage/opendaylight/plugins/test-app-0.0.3-SNAPSHOT.jar" by thread "fileinstall-./plugins". at org.eclipse.osgi.framework.internal.core.AbstractBundle.beginStateChange(AbstractBundle.java:1088) ~[org.eclipse.osgi-3.8.1.v20120830-144521.jar:na] at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.suspendBundle(PackageAdminImpl.java:330) ~[org.eclipse.osgi-3.8.1.v20120830-144521.jar:na] at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.processDelta(PackageAdminImpl.java:467) ~[org.eclipse.osgi-3.8.1.v20120830-144521.jar:na] at org.eclipse.osgi.framework ... (more)

edit retag flag offensive close merge delete

Comments

Is your rabbitMQ client OSGI bundle or not? Is rabbitMQ part of your distribution? Which distribution did you used? Please look for rabbitMQ and OSGI integration.

Tony Tkacik ( 2014-10-22 02:27:25 -0700 )edit

RabbitMQ librabry is OSGi compatible as per their developers and mentioned in website too. I have tried with 3.3.5 version. What do you mean by "Is rabbitMQ part of my distribution"??? I am using the maven repo of rabbitMQ. When i compile my module,it should download the RabbitMQ from the mvn repo.

gyanesh ( 2014-10-27 03:38:38 -0700 )edit

I meant if rabbitMQ and it dependencies are present in OSGI container (plugins folder) in legacy distribution or rabbitMQ feature / bundles installed in Karaf.

Tony Tkacik ( 2014-11-10 01:32:44 -0700 )edit

Copying into plugins folder worked for me. I haven't tried with karaf. Thanks for the help.

gyanesh ( 2015-03-04 06:02:59 -0700 )edit