Reference/link to local interface in different jar (Jboss 2.
jardia Nov 10, 2001 2:46 PMHi.
This looks long but please have a look, just trying to be thorough.
Does anyone know whether jboss supports the feature described in the ejb2.0
dtd whereby a bean can reference another bean packaged in a seperate jar file?
Here is the bit i'm talking about (from http://java.sun.com/dtd/ejb-jar_2_0.dtd ):
[pre]
<!--
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 value of the ejb-link element must be the ejb-name of an
enterprise bean in the same ejb-jar file or in another ejb-jar
file in the same J2EE application unit.
Alternatively, the name in the ejb-link element may be composed of a
path name specifying the ejb-jar containing the referenced enterprise
bean with the ejb-name of the target bean appended and separated from
the path name by "#". The path name is relative to the ejb-jar file
containing the enterprise bean that is referencing the enterprise bean.
This allows multiple enterprise beans with the same ejb-name to be
uniquely identified.
Used in: ejb-local-ref, ejb-ref
Examples:
<ejb-link>EmployeeRecord</ejb-link>
<ejb-link>../products/product.jar#ProductEJB</ejb-link>
-->
[/pre]
I'm having problems getting this to work. When deploying beanA, jboss says
"Cause:org.jboss.ejb.DeploymentException: Bean beanC.jar#ejb/bean_c not found within this application."
What I'm doing:
1. SFSB BeanA that wants to get a:
- remote reference to BeanB
- local reference to BeanC
2. BeanB is deployed in its own jar (beanB.jar)
3. BeanC is deployed in its own jar (beanC.jar)
4. BeanA is deployed and then error happens....
Files:
[pre]
== BeanA deployment descriptor ==
=================================
<ejb-jar>
<enterprise-beans>
<ejb-name>bean_a</ejb-name>
BeanAHome
BeanA
<ejb-class>BeanAEJB</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
<!-- remote reference -->
<ejb-ref>
Reference to beanB through its remote interface
<ejb-ref-name>ejb/refToBeanB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
BeanBHome
BeanB
</ejb-ref>
<!-- local reference -->
<ejb-local-ref>
Reference to beanC through its local interface
<!--The logical name used with the referencing bean's code to refer to this reference-->
<ejb-ref-name>ejb/refToBeanC</ejb-ref-name>
<!--The Java type expected by the enterprise bean-->
<ejb-ref-type>Session</ejb-ref-type>
<!--The fully qualified class name for the referenced bean's local home interface-->
<local-home>BeanCHome</local-home>
<!--The fully qualified class name for the referenced bean's local interface-->
BeanC
<!-- An optional (see notes)-->
<!-- But in JBOSS: Local references currently require ejb-link -->
<ejb-link>beanC.jar#ejb/bean_c</ejb-link>
</ejb-local-ref>
</enterprise-beans>
</ejb-jar>
== BeanA jboss.xml ==
======================
<enterprise-beans>
<ejb-name>bean_a</ejb-name>
<jndi-name>ejb/bean_a</jndi-name>
<ejb-ref>
<ejb-ref-name>ejb/refToBeanB</ejb-ref-name>
<jndi-name>ejb/bean_b</jndi-name>
</ejb-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/refToBeanC</ejb-ref-name>
<jndi-name>ejb/bean_c</jndi-name>
</ejb-local-ref>
</enterprise-beans>
== BeanC deployment descriptor ==
=================================
<ejb-jar>
<enterprise-beans>
<ejb-name>ejb/bean_c</ejb-name>
<local-home>BeanCHome</local-home>
BeanC
<ejb-class>BeanCEJB</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
</enterprise-beans>
</ejb-jar>
[/pre]