[jboss-jira] [JBoss JIRA] Created: (JBAS-9032) @EJB injection with same "name" on two different fields leads to DuplicateServiceException

jaikiran pai (JIRA) jira-events at lists.jboss.org
Thu Mar 17 07:49:49 EDT 2011


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

                 Key: JBAS-9032
                 URL: https://issues.jboss.org/browse/JBAS-9032
             Project: JBoss Application Server
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions: 7.0.0.Beta1
         Environment: JBoss AS7 master, JBoss AS 7.0 Beta1
            Reporter: jaikiran pai


Consider this servlet (or any other component):

{code}
public class MyServlet extends HttpServlet {

 @EJB (name="simpleName", beanName="SomeEJB")
 private SomeEJB bean;

 @EJB (name="simpleName", beanName="SomeEJB")
 private SomeEJB beanAgain;
...
}
{code}

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:

{code}
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)
{code}



--
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