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:
public class GrossmontBank
//class variables (global - accessible throughout this class)
//scanner object to be used throughout
private static Scanner input = new Scanner(System.in);