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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 7.0.0.Beta3
    • 7.0.0.Beta2
    • EE
    • 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.

      Attachments

        Activity

          People

            jaikiran Jaikiran Pai (Inactive)
            jaikiran Jaikiran Pai (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: