0 Replies Latest reply on Jul 15, 2011 4:47 AM by miragpl

    EJB jndi name/injection problem

    miragpl

      Hi,

       

      In my project I have an MBean that has to use local singleton EJB. Unfortunately I cannot resolve EJB in MBean class.

      Two approached I tried actually failed and I would like to know why.

       

      First I tried with @EJB annotation on field of my MBean. I put everything in EAR file and it seems (according to logs) that my ejbs are being deployed before my mbean but anyway the ejb field is empty. Anyone could give me a hint why?:)

       

      Than i tried with resolving @EJB with InitialContext. I noticed that my EJBs had been registered with name:

      ear_name/ejb_jar_name/ejbname!ejb_interface_class. What should I do to register them with other jndi name?

      I tried to set name and mappedName property of @Singleton annotation which I use but without success.

       

      Here is how my ejb looks like

       

      @Singleton(name="testEJB",mappedName="testEJB")

      @Startup

      @Local(ITest.class)

      public class TestEJB implements ITest {

       

           @Override

           public void test() {

          }

      }

       

      I use Jboss 6 Final and Java 1.6_20

       

       

      Thanks for any help,

       

      Regards