Is it possible to call OSGI service implemented in external bundle from EAR package? Is there a tutorial how this is implemented?


Yes, I see that you've answered your own question whilst looking into this. This thread can now be closed!

Yes, I see that you've answered your own question whilst looking into this. This thread can now be closed!

Thank you for the reply! Would you point me a tutorial with example how this can be implemented, please?

Oh okay, from what I found you can follow this tutorial creating a managed bean into the EAR file then implementing a java interface within the OSGI bundle:


Thank you for the reply!
Unfortunately I use Netbeans 7.1 and JBoss 7.1.0. I already knew about this tutorial. He is made for glassfish server and he uses glassfish specific dependencies.

I created a WAR package with OSGI bundle and I tested it successfully. But still I can't find a solution for my problem. I tried to create EAR package with OSGI bundle but the problem is that every time when I try to deploy it into JBoss NullPoint Exeption occurs.
Maybe the problem is in JBoss, I use version 7.1.0.RC1B. Or maybe by design this is not allowed in JBoss? I don't know. I also have another problem - I can't use @Datasource into OSGI bundle and deploy it on JBoss.

I'm getting very angry from JBoss - it seems that I waste my time with this buggy software.

If you're interested I can provide you the simple source code of the EAR package and the OSGI bundle that I cannot deplot. I will really appreciate your help if you help me to fix the problem.

I don't have any other alternative except to switch to Glassfish.


You could post your code in case an OSGI expert comes along but there doesn't seem to be many, I don't really have the OSGI experience myself. IBM seem very knowledgable in this area, I would have a look at their libraries which contain a lot on OSGI (below), there is also an IBM'er on YouTube providing tutorials and also look into OSGI books like O'Reilly.

If none of that work, I would look into checking form more tutorials using something other than NetBeans...

The OSGI Alliance provides tutorials for OSGI with Eclipse Equinox, Knopflerfish and Apache Felix also:

OSGI Alliance - How To

IBM OSGI Library:



OSGI Alliance Books:

Including OSGi Enteprise Specification, v4.2:

OSGi in Action (I'm helping write this)

OSGi in Practice (Creative Commons)

Modular Java (OSGi + Spring DM)

Pro Spring Dynamic Modules for OSGi™ Service Platforms

Hope that helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.