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

@EJB injection with same "name" on two different fields leads to DuplicateServiceException

    Details

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

      JBoss AS7 master, JBoss AS 7.0 Beta1

      Description

      Consider this servlet (or any other component):

      public class MyServlet extends HttpServlet {
      
       @EJB (name="simpleName", beanName="SomeEJB")
       private SomeEJB bean;
      
       @EJB (name="simpleName", beanName="SomeEJB")
       private SomeEJB beanAgain;
      ...
      }
      

      Notice that both the @EJB injection points expect the bean to be injected from bean in ENC at java:comp/env/simpleName. This however, leads to exception during deployment with the following message:

      16:06:43,846 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.unit."myejbapp.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."myejbapp.war".INSTALL: Failed to process phase INSTALL of deployment "myejbapp.war"
      	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:108)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1344)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_21]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_21]
      	at java.lang.Thread.run(Thread.java:619) [:1.6.0_21]
      Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.naming.context.java.module.myejbapp.myejbapp.env/simpleName is already registered
      	at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:143)
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: