I saw your code. I think you are implementing EJB first time. Please do not misunderstand. Though I didn't work on JBOSS, but your nullPointerException can be handled by creating new instance of your component interface, which you didn't created in your client code.
Tell me first whether you are implementing local view or remote view of your application. Also tell me which type of EJB bean you are using?
Im not implementing EJB for the first time, although Im new to DI. You can find that Im using Stateless Session bean by looking at the @Stateless annotation. You could also find that Im using Remote view using the @Remote annotation. Im not sure what you meant by creating a new instance of Component Interface.
In GlassFish AS, we would use the ACC application client container to run the client. I wanted to find whether there are similar client containers in JBoss as well.
In glassfish, you can use the appclient <jar-name> that simply runs the application in the environment of the application server. That is why DI works there.
However, for the said code above, it won't work because you are running the client as a stand alone application. For stand alone application, you need to create a Context supplying the
parameters for the provider(i.e. ORB host, port, provider url). DI on application client will only work if you packaged it within an EAR. I am not sure how to do this in JBoss though.
I suggest creating a new EAR and test the DI functionality in a servlet if the sole purpose is to test the DI functionality.
I hope this helps.
Uy Jerwin Louise Vergara
Junior Developer / Research and Development at Incuventure Partners Corporation