Hi Cheng,
>
> When you have the ejb-jar and war deployed on the
> same server instance (or difference instances within
> a cluster), no need to use corbaname. A plain
> @EJB(mappedName="NamedSecurityBean") should work,
> since the global jndi-name NamedSecurityBean is
> unique server-wide. But using corbaname doesn't hurt
> anyway.
I was using the corbaname here to see if there might be any problem with the syntax, etc. and i was hoping that i could use this method to deploy the war file anywhere without having to bother if the target EJB is in the same instance/cluster or not since i consider the corbaname to be the most general way to access an EJB.
>
>
> > But when i deploy the archives on different
> > instances, even when they are of the same
> appserver
> > type, the lookup fails. I am not using any ejb
> > related tags in the web.xml and no deployment
> > descriptors at all in the .jar file. The EJB
> > interface is annotated as @Remote and the
> > implementing bean as
> > @Stateless(mappedName="NamedSecurityBean"). When
> > listing all JNDI entries from a stand alone client
> i
> > can see the NamedSecurityBean being displayed with
> > exactly this name.
>
> When the servlet access an EJB deployed on another
> glassfish server instance on the same or different
> host, and these 2 instances are not within a cluster,
> you need to use corbaname:
> @EJB(mappedName="corbaname:iiop:1.2_at_host2:3700#NamedSe
> curityBean") private SecurityTest secTest;
That is exactly what i was doing, except that i put localhost instead of host2, but that should be a valid value, shouldn't it? Unfortunatly it did not work. After reading through the FAQ again i changed the EJB annotation to
@EJB(name="SecurityTest") private SecurityTest secTest;
and added a sun-web.xml with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 Servlet 2.3//EN" "
http://www.sun.com/software/sunone/appserver/dtds/sun-web-app_2_3-1.dtd">
<sun-web-app>
<ejb-ref>
<ejb-ref-name>SecurityTest</ejb-ref-name>
<jndi-name>
corbaname:iiop:1.2_at_localhost:7001#NamedSecurityBean
</jndi-name>
</ejb-ref>
</sun-web-app>
With this i can call the EJB from the war file when both are deployed on different glassfish domains (as far as i can see they are not in the same cluster, having different classpaths etc). I always thought with annotations the propietary deployment descriptors (sun-web.xml, sun-jar.xml, etc.) became redundant.
> If you are trying interop between glassfish and other
> appservers like JBoss or Weblogic, some restrictions
> may apply. Please see this thread:
>
> http://forums.java.net/jive/thread.jspa?threadID=34436
> &tstart=15
Thanks, i will have a look at this.
Cheers, Chris
[Message sent by forum member 'candlejack' (candlejack)]
http://forums.java.net/jive/thread.jspa?messageID=251003