geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anita Kulshreshtha <a_kuls...@yahoo.com>
Subject Re: Problem with referencing to beans from other ejb-jars
Date Thu, 20 Sep 2007 13:35:07 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
@RemoteHome(javax.management.j2ee.ManagementHome.class)
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 - 
       <ejb-ref>
            <ref-name>MyEJB</ref-name>  <!-- currently this must be
same as the name in @Stateless -->
            <nam:pattern
xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
                <nam:artifactId>myremoteejb</nam:artifactId>
                <nam:name>MyEJB</nam:name>
            </nam:pattern>
        </ejb-ref>
3. Lookup using ctx.lookup("java:comp/env/MyEJB")

   This ejb can be looked up from a java client using     
ctx.lookup("myremoteejb/MyEJB/javax.management.j2ee.ManagementHome").
this name can be found in <geronimo-Hone>/var/geronimo.log.

   Thanks to David Blevins for providing the critical information. A
working example can be found here - 
https://issues.apache.org/jira/secure/attachment/12366181/mejb-ejb-2.1-SNAPSHOT.jar
https://issues.apache.org/jira/secure/attachment/12366282/mejb-war-2.1-SNAPSHOT.war

Thanks
Anita



      ____________________________________________________________________________________
Don't let your dream ride pass you by. Make it a reality with Yahoo! Autos.
http://autos.yahoo.com/index.html
 



Mime
View raw message