Internal EJB reference
EJB Hand's On to Clear Concepts
Internal EJB reference
What is ejb-ref:: ejb-link??
The ejb-link element is used in the ejb-ref or ejb-local-ref
elements to specify that an EJB reference is linked to an
enterprise bean. The path name is relative to the war file
containing the web application that is referencing the enterprise bean.
This allows multiple enterprise beans with the same ejb-name to be
uniquely identified.
<ejb-link> is used so that servlets from the same application unit can refer ejb. If we specify <ejb-link> then we don't need to specify any thing in application server specific web.xml file(incase of jboss jboss-web.xml file)
The following example demonstrate the same.
<web-app>
………
<ejb-ref >
<description><![CDATA[Reference to the Sidd EJB]]></description>
<ejb-ref-name>ejb/Sidd</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>tutorial.interfaces.SiddHome</home>
<remote>tutorial.interfaces.Sidd</remote>
<ejb-link>MyEJB1.jar#Sidd</ejb-link>
</ejb-ref>
</web-app>
<jboss-web>
……
<ejb-ref>
<ejb-ref-name>ejb/Sidd</ejb-ref-name>
<jndi-name>ejb/beanB</jndi-name>
</ejb-ref>
It say's that Ejb "Sidd" ejb/Sidd refers to the ejb bean named "Sidd" found in MyEJB1.jar in the same ear file.
Note:: Note that the <ejb-ref-name> tags in the 2 xml files must match.
Internal EJB reference
What is ejb-ref:: ejb-link??
The ejb-link element is used in the ejb-ref or ejb-local-ref
elements to specify that an EJB reference is linked to an
enterprise bean. The path name is relative to the war file
containing the web application that is referencing the enterprise bean.
This allows multiple enterprise beans with the same ejb-name to be
uniquely identified.
<ejb-link> is used so that servlets from the same application unit can refer ejb. If we specify <ejb-link> then we don't need to specify any thing in application server specific web.xml file(incase of jboss jboss-web.xml file)
The following example demonstrate the same.
<web-app>
………
<ejb-ref >
<description><![CDATA[Reference to the Sidd EJB]]></description>
<ejb-ref-name>ejb/Sidd</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>tutorial.interfaces.SiddHome</home>
<remote>tutorial.interfaces.Sidd</remote>
<ejb-link>MyEJB1.jar#Sidd</ejb-link>
</ejb-ref>
</web-app>
<jboss-web>
……
<ejb-ref>
<ejb-ref-name>ejb/Sidd</ejb-ref-name>
<jndi-name>ejb/beanB</jndi-name>
</ejb-ref>
It say's that Ejb "Sidd" ejb/Sidd refers to the ejb bean named "Sidd" found in MyEJB1.jar in the same ear file.
Note:: Note that the <ejb-ref-name> tags in the 2 xml files must match.
Comments
Post a Comment