users@glassfish.java.net

Re: Interop with Glassfish and other application servers

From: <glassfish_at_javadesktop.org>
Date: Fri, 30 Nov 2007 07:41:18 PST

Hi, Chris,

https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html has some tips related to ejb and jndi configuration. These jndi configuration data should not be in any of your java code. Whether you look up something local or remote, same server or different server, your java code is the same. Even your ejb-jar.xml or web.xml is the same. The difference is in sun-web.xml, or sun-ejb-jar.xml, or weblogic-ejb-jar.xml, etc.

My previous post showed the injection way. But if you prefer lookup on your client side:
Context ic = new InitialContext();
Object obj = ic.lookup("java:comp/env/[b]ejb/fooRef[/b]");

web.xml should have a
<ejb-ref>
<ejb-ref-name><b>ejb/fooRef</b></ejb-ref-name>

sun-web.xml should have a
<ejb-ref>
<ejb-ref-name>ejb/fooRef</ejb-ref-name>
<jndi-name>corbaname:iiop:1.2_at_localhost:7001#ejb/foo</jndi-name>
</ejb-ref>

ejb/foo is the global jndi name of the EJB on wls. I think the hard part of this interop exercise is to get wls side working, and the glassfish side should be a breeze.

If you wish, you can post your project, war, and ejb-jar here.

-cheng
[Message sent by forum member 'cf126330' (cf126330)]

http://forums.java.net/jive/thread.jspa?messageID=248019