[jboss-jira] [JBoss JIRA] Created: (JBAS-9267) @EJB with lookup = java:comp in a Servlet leads to incorrect service dependency creation

jaikiran pai (JIRA) jira-events at lists.jboss.org
Thu Apr 7 10:47:33 EDT 2011


@EJB with lookup = java:comp in a Servlet leads to incorrect service dependency creation
----------------------------------------------------------------------------------------

                 Key: JBAS-9267
                 URL: https://issues.jboss.org/browse/JBAS-9267
             Project: JBoss Application Server
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: EE
    Affects Versions: 7.0.0.Beta2
         Environment: AS7 upstream (April 7 2011)
            Reporter: jaikiran pai
            Assignee: jaikiran pai
             Fix For: 7.0.0.Beta3


Consider this servlet:

{code}
public class MyServlet extends HttpServlet {

  @EJB(name="ejb/myBean")
  private MyBeanIntf bean;

  @EJB(lookup="java:comp/env/ejb/myBean")
  private MyBeanIntf beanAgain;
...
{code}

This leads to a failed deployment due an incorrect service dependency creation, which ultimately leads to a missing dependency. 

The injection target beanAgain sets up a binding description whose source ends up adding a dependency on:
{code}
jboss.naming.context.java.comp.appName.moduleName.moduleName.env/ejb/myBean 
{code}
Notice that it adds a dependency on java:comp naming context. But since servlets (web module) runs under a java:module context, this service dependency is never satisfied.

The LookupBindingSourceDescription should take into account the ComponentNamingMode *and the lookup jndi name value* (i.e. check for java:comp) before creating the correct service dependency.







--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list