geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anita Kulshreshtha <>
Subject Re: Problem with referencing to beans from other ejb-jars
Date Thu, 20 Sep 2007 13:28:30 GMT
   This example answers a simpler but related question: 
   How to refer to an EJB (remote) deployed as an ejb jar (or ear) from
another web application?

The EJB - 

@Stateless(name="MyEJB")  //JNDI name will be java:comp/env/MyEJB
public class MEJB .........

This ejb is packaged in a jar named myejb-2.1.jar  and deployed as
org.myorg/myremoteejb/2.1/car (this name comes from openejb-jar.xml).
The web.xml contains usual stuff.

To look up this ejb from another application, e.g. a web application do
the following in geronimo-web.xml - 
1. declare a dependency on org.myorg/myremoteejb/2.1/car
2. Add a ejb-ref as shown below - 
            <ref-name>MyEJB</ref-name>  <!-- currently this must be
same as the name in @Stateless -->
3. Lookup using ctx.lookup("java:comp/env/MyEJB")

   This ejb can be looked up from a java client using     
this name can be found in <geronimo-Hone>/var/geronimo.log.

   Thanks to David Blevins for providing the critical information.


Yahoo! oneSearch: Finally, mobile search 
that gives answers, not web links.

View raw message