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/16 08:39:00 UTC
[jira] [Comment Edited] (TOMEE-2066) Issue with EJB injection
[ https://issues.apache.org/jira/browse/TOMEE-2066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16051591#comment-16051591 ]
Svetlin Zarev edited comment on TOMEE-2066 at 6/16/17 8:38 AM:
---------------------------------------------------------------
The issue was caused by incomplete annotations API (javax.EJB was missing the lookup() method) on my side.
was (Author: svetlinzarev):
The issue was caused by incomplete javax.annotations API on my side .
> Issue with EJB injection
> ------------------------
>
> Key: TOMEE-2066
> URL: https://issues.apache.org/jira/browse/TOMEE-2066
> Project: TomEE
> Issue Type: Bug
> Affects Versions: 7.0.3
> Reporter: Svetlin Zarev
> Attachments: sample - v2.zip, sample.zip, screenshot-1.png
>
>
> 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)