We are developing custom framework for our application. EJB one is using reflection API to instatiate EJB 2 class and then invoking method of EJB 2. EJB 2 has EJB 3 reference (defined as @EJB). When i deploy code and run, i am able to get new instance(not sure whether it's created by EJB Container or not) of EJB2, but in EJB 3 is getting instatantiated.
Is it possible to create instance of an EJB 3.0 stateless class using Reflection API. I am running my application in JBoss 5.
You are not supposed to instantiate EJB bean instances at all. It's upto the container to do that. You are expected to use the JNDI or injection to get hold of the EJB instances.