Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-279

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

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 7.0.0.Beta2
    • Fix Version/s: 7.0.0.Beta3
    • Component/s: EE
    • Labels:
      None

      Description

      Consider this servlet:

      public class MyServlet extends HttpServlet {
      
        @EJB(name="ejb/myBean")
        private MyBeanIntf bean;
      
        @EJB(lookup="java:comp/env/ejb/myBean")
        private MyBeanIntf beanAgain;
      ...
      

      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:

      jboss.naming.context.java.comp.appName.moduleName.moduleName.env/ejb/myBean 
      

      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.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                jaikiran Jaikiran Pai
                Reporter:
                jaikiran Jaikiran Pai
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: