[
https://issues.apache.org/jira/browse/GERONIMO-4210?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
YunFeng Ma updated GERONIMO-4210:
---------------------------------
Attachment: GERONIMO-4210.patch
Let's look what's going on with this problem:
For example, a web application has two managed been (or servlet, taget) like
bellow:
{noformat}
public class ABean {
@EJB(name = "mybean")
private MyBean mybean;
}
public class BBean {
@EJB(name = "mybean")
private MyBean mybean;
}
{noformat}
The EJBAnnotationHelper processes the above two annotations and generates the
following descriptor:
{noformat}
<jav:ejb-local-ref>
<jav:ejb-ref-name>mybean</jav:ejb-ref-name>
<jav:local>test.MyBean</jav:local>
<jav:injection-target>
<jav:injection-target-class>test.ABean</jav:injection-target-class>
<jav:injection-target-name>mybean</jav:injection-target-name>
</jav:injection-target>
</jav:ejb-local-ref>
{noformat}
According to the above descriptor, only mybean in ABean is injected, the mybean
in BBean is not injected.
The attached patch will generate the following descriptor:
{noformat}
<jav:ejb-local-ref>
<jav:ejb-ref-name>mybean</jav:ejb-ref-name>
<jav:local>test.MyBean</jav:local>
<jav:injection-target>
<jav:injection-target-class>test.ABean</jav:injection-target-class>
<jav:injection-target-name>mybean</jav:injection-target-name>
</jav:injection-target>
<jav:injection-target>
<jav:injection-target-class>test.BBean</jav:injection-target-class>
<jav:injection-target-name>mybean</jav:injection-target-name>
</jav:injection-target>
</jav:ejb-local-ref>
{noformat}
Then mybean in BBean is injected.
Please review the patch and if it's OK, I'll provide a patch for v2.1. Thanks.
> EJB Injection in JSF Managed Bean
> ---------------------------------
>
> Key: GERONIMO-4210
> URL: https://issues.apache.org/jira/browse/GERONIMO-4210
> Project: Geronimo
> Issue Type: Bug
> Security Level: public(Regular issues)
> Affects Versions: 2.1.1
> Environment: Linux antares 2.6.25-2-686 #1 SMP Fri Jun 27 03:23:20
> UTC 2008 i686 GNU/Linux
> Debian
> java version "1.6.0_06"
> Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
> Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)
> Reporter: Matthias Berndt
> Attachments: GERONIMO-4210.patch, ltg3.tar.gz
>
>
> I've got two managed beans in a JSF 1.2 webapp. Both beans are quite equal. I
> try to inject a stateless session bean (EJB3) into the managed beans.
> @EJB(name = "java:comp/env/ejb/CredentialData")
> private CredentialData credentialData;
> In the first managed bean the EJB is injected correctly in
> CredentialDataController. The second bean with exactly the same injection
> code does not get the EJB inCredentialTableBean. There is no error but at
> runtime credentialData is null.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.