tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Svetlin Zarev (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (TOMEE-2066) Issue with EJB injection
Date Thu, 15 Jun 2017 11:07:00 GMT

     [ https://issues.apache.org/jira/browse/TOMEE-2066?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Svetlin Zarev updated TOMEE-2066:
---------------------------------
    Description: 
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

  was:
*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


> Issue with EJB injection
> ------------------------
>
>                 Key: TOMEE-2066
>                 URL: https://issues.apache.org/jira/browse/TOMEE-2066
>             Project: TomEE
>          Issue Type: Bug
>            Reporter: Svetlin Zarev
>         Attachments: sample.zip
>
>
> 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)

Mime
View raw message