You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Svetlin Zarev (JIRA)" <ji...@apache.org> on 2017/06/15 11:04:00 UTC

[jira] [Created] (TOMEE-2066) Issue with EJB inection

Svetlin Zarev created TOMEE-2066:
------------------------------------

             Summary: Issue with EJB inection
                 Key: TOMEE-2066
                 URL: https://issues.apache.org/jira/browse/TOMEE-2066
             Project: TomEE
          Issue Type: Bug
            Reporter: Svetlin Zarev
         Attachments: sample.zip

*Test case: *

Servlet with:
{code}
 @EJB(beanName = "FirstBean", name = "ejb/TestServlet/first")
    SessionBean firstByBeanName;

    @EJB(beanName = "SecondBean", name = "ejb/TestServlet/second")
    SessionBean secondByBeanName;

    @EJB(lookup = "java:comp/env/ejb/TestServlet/first")
    private SessionBean firstByLookup;

    @EJB(lookup = "java:comp/env/ejb/TestServlet/second")
    private SessionBean secondByLookup;
{code}

Expected Output:
{code}
FirstBean (by BeanName): org.example.FirstBean
SecondBean (by BeanName): org.example.SecondBean
FirstBean (by lookup): org.example.FirstBean
SecondBean (by lookup): org.example.SecondBean
{code}

Actual Output: 
{code}
FirstBean (by BeanName): org.example.FirstBean
SecondBean (by BeanName): org.example.SecondBean
FirstBean (by lookup): org.example.SecondBean
SecondBean (by lookup): org.example.SecondBean
{code}

Problem:
"FirstBean (by lookup)" or "SecondBean (by lookup)" are always injected the same instance - i.e. either FirstBean or SecondBean, while FirstBean should be injected FisrtBean, and SecondBean -> SecondBean.

Attached application that reproduces the issue and prints the naming context



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)