<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>StatelessSBBean</ejb-name>
<ejb-local-ref>
<ejb-ref-name>aaa</ejb-ref-name>
<injection-target>
<injection-target-class>com.mellon.StatelessSBBean</injection-target-class>
<injection-target-name>refLocal</injection-target-name>
</injection-target>
</ejb-local-ref>
</session>
</enterprise-beans>
</ejb-jar>
Believe it or not, the above descriptor works well. Here are code lines of my bean:
@Stateless
public class StatelessSBBean implements StatelessSBLocal {
private ReferencedLocal refLocal;
public void business(){
refLocal.method();
}
}
O'REILLY book "Enterprise
Java Beans 3.0", says that <ejb-ref-name>, <ejb-ref-type>, <remote> are required.
"The <ejb-ref> element defines a reference to remote EJBs. It contains the subelements <description> (optional), <ejb-ref-name>
(required), <ejb-ref-type> (required), <remote> (required), <home> (optional), <ejb-link> (optional), and <mapped-name> (optional), as
well as the element <injection-target> (optional) described in the first part of this chapter."
I checked the relevant parts in JSR 220 Page 417:
"The ejb-ref-name element specifies the
EJB reference name: its value is the environment entry name used in the enterprise bean code. The ejb-ref-name must be specified. The optional ejb-ref-type element specifies the expected type of the enterprise bean: its value must be either Entity or Session. The home and remote or local-home and local elements specify the
expected Java types of the referenced enterprise bean�s interface(s). If the reference is to an EJB 2.1 remote client view interface, the home element is required. Likewise, if the reference is to an EJB 2.1 local client view interface, the local-home element is required. "
Book is wrong again?