EventAdmin Bundle Installation
Hi OSGi Gurus, I am new to OSGi. I have an application that processes messages/metrics events in a high volume My main application which recieves these events/metrics is an non-OSGi bundle. However, the task for this application is to forward the event/payload to an OSGi bundle. I don't have issues with OSGi bundle as I am able to install the bundle and also added the EventHandler there.My issue occurs when I send the events from my main application. My service reference is always null. In short EventAdmin reference is always null. I am sure I need to install the EventAdmin as a bundle. How can I do it at the top level application? Can you please help me the actual Java code/pseudo that would install the bundle? Dependencies in my pom: dependencies dependency groupIdcom.ebay.external/groupId artifactIducirrus-db/artifactId version0.7.3/version /dependency dependency groupIdorg.apache.felix/groupId artifactIdorg.apache.felix.framework/artifactId version4.2.1/version /dependency dependency groupIdorg.apache.felix/groupId artifactIdorg.apache.felix.bundlerepository/artifactId version1.6.6/version /dependency dependency groupIdorg.ops4j.pax.url/groupId artifactIdpax-url-mvn/artifactId version1.3.6/version /dependency dependency groupIdorg.apache.felix/groupId artifactIdorg.apache.felix.eventadmin/artifactId version1.3.2/version /dependency dependency groupIdmockit/groupId artifactIdjmockit/artifactId version0.999.4/version typejar/type scopetest/scope /dependency dependency groupIdjunit/groupId artifactIdjunit/artifactId scopetest/scope version4.5/version!--$NO-MVN-MAN-VER$ -- /dependency dependency groupIdorg.osgi/groupId artifactIdorg.osgi.core/artifactId version4.3.0/version!--$NO-MVN-MAN-VER$ -- typejar/type scopecompile/scope /dependency dependency groupIdorg.osgi/groupId artifactIdorg.osgi.compendium/artifactId version4.3.1/version typejar/type scopecompile/scope /dependency /dependencies Here is simple Java code that I am using to install the EventAdmin bundle //now install the EventAdmin: org.apache.felix.eventadmin 1.3.2 Bundle eventAdminBundle = framework.getBundleContext().installBundle(org.apache.felix.eventadmin); eventAdminBundle.start();Is this not the right way? Any pointers are highly appreciated Thanks Masti
Re: EventAdmin Bundle Installation
On 01 Feb 2014, at 23:20 pm, masti whoknows masti...@yahoo.com wrote: Here is simple Java code that I am using to install the EventAdmin bundle //now install the EventAdmin: org.apache.felix.eventadmin 1.3.2 Bundle eventAdminBundle = framework.getBundleContext().installBundle(org.apache.felix.eventadmin); eventAdminBundle.start();Is this not the right way? No, as you can see from your own stacktrace, installBundle takes a location [1] which is interpreted as a URL. Alternatively, you can use the other installBundle method [2] that takes a location (which can then be anything) and an inputstream (to your bundle). That should at least get you to the next point. :) To learn more about embedding Felix, please read [3] and especially the Host/Felix interaction part of that document. It contains a lot of information related to what you're trying to do. Greetings, Marcel [1] http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html#installBundle(java.lang.String) [2] http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html#installBundle(java.lang.String, java.io.InputStream) [3] http://felix.apache.org/documentation/subprojects/apache-felix-framework/apache-felix-framework-launching-and-embedding.html