Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-254

@EJB doesn't work in Embeddable EJB3 alpha

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • EJB 3.0 RC3
    • EJB 3.0 RC3
    • None
    • None

      Changed the tutorial /mcdeploy/ to include a second SLSB and tried to get it injected into the existing one using "@EJB BeanBLocal". Failed with the following exception:

      [java] INFO org.jboss.ejb3.Ejb3AnnotationHandler:getContainers:109 - found EJB3: ejbName=org.jboss.tutorial.mcdeploy.BeanB, class=org.jboss.tutorial.mcdeploy.BeanB, type=STATELESS
      [java] DEBUG org.jboss.ejb3.Ejb3Deployment:registerContainer:227 - Bound ejb3 container jboss.j2ee:service=EJB3,name=org.jboss.tutorial.mcdeploy.BeanB

      [java] Exception in thread "main" java.lang.RuntimeException: Unable to @Inject jndi dependency: beanB into field org.jboss.tutorial.mcdeploy.BeanBLocal org.jboss.tutorial.mcdeploy.CustomerDAOBean.beanB of class org.jboss.tutorial.mcdeploy.CustomerDAOBean
      [java] at org.jboss.ejb3.injection.JndiFieldInjector.inject(JndiFieldInjector.java:48)
      [java] at org.jboss.ejb3.AbstractPool.create(AbstractPool.java:59)
      [java] at org.jboss.ejb3.ThreadlocalPool.get(ThreadlocalPool.java:33)
      [java] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:36)
      [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:91)
      [java] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:63)
      [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:91)
      [java] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:91)
      [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:91)
      [java] at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:152)
      [java] at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:60)
      [java] at $Proxy13.createCustomer(Unknown Source)
      [java] at org.jboss.tutorial.mcdeploy.Main.main(Main.java:32)
      [java] Caused by: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial]
      [java] at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1052)
      [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:685)
      [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      [java] at org.jboss.ejb3.injection.JndiFieldInjector.inject(JndiFieldInjector.java:44)
      [java] ... 12 more
      [java] Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
      [java] at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
      [java] at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
      [java] at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
      [java] at javax.naming.InitialContext.lookup(InitialContext.java:351)
      [java] at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1046)
      [java] ... 15 more
      [java] Java Result: 1

      As there is no single example in the tutorials of using @EJB I believe that there is probably also a test missing.

              Unassigned Unassigned
              christian.bauer_jira Christian Bauer (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: