users@glassfish.java.net

Re: Manual lookup of remote EJB in Glassfish

From: <glassfish_at_javadesktop.org>
Date: Wed, 27 Oct 2010 08:26:19 PDT

I've been working with remote ejb calls for the passed few weeks, I've gotten non-secure remote ejb calls from one glassfish server to another working fairly well.

On your client web-app have the following:

@EJB(lookup="java:comp/env/ejb/HomerSimpson")
private StatusService statusService;

[b]web.xml[/b]
<ejb-ref>
<ejb-ref-name>ejb/HomerSimpson</ejb-ref-name>
<remote>no.evote.service.StatusService</remote>
</ejb-ref>

[b]sun-web.xml[/b]
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD
GlassFish Application Server 3.0 Servlet 3.0//EN"
"http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app>
<context-root>webappRoot</context-root>
<ejb-ref>
<ejb-ref-name>ejb/HomerSimpson</ejb-ref-name>
<jndi-name>
corbaname:iiop:[server.domainname.com]:3700#java:global/[ear-file-name]/[module-name]/[StatusServiceImpl]!no.evote.service.StatusService
</jndi-name>
</ejb-ref>
</sun-web-app>

When you deploy the EJB's, go to the glassfish logs and you'll be able to see the global name assigned to your bean. Replace the [ear-file-name], [module-name], and [StatusServiceImpl] whith what glassfish logs. Of course [server.domainname.com] is replaced with the name of the server hosting your EJBs.
[Message sent by forum member 'mjremijan']

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