users@glassfish.java.net

Re: [nbj2ee] Re: Help: access a Local Session Bean from another EAR

From: Sahoo <sanjeeb.sahoo_at_oracle.com>
Date: Sun, 17 Apr 2011 05:26:18 +0530

The EJB spec does not disallow invocation of local EJBs from other
applications. It is an optional feature and left to vendors. In
GlassFish, one can access local EJBs from other applications by using
OSGi/EJB applications approach, where in the local EJBs are made
available as OSGi services and then consumed from other bundles using
OSGi service registry.

Sahoo

On Saturday 16 April 2011 01:43 AM, Steven Siebert wrote:
> Nope. I believe Jason iis correct, as according to the EJB
> specification, you must use the remote interface to access and EJB
> from another archive (EAR, EJB, or WAR). This is for security
> reasons, because you may have both a local and remote interface on a
> single EJB class, allowing you to specify different interfaces for
> internal and external consumption. I'm curious as to why the JNDI
> approach works - and wonder if this is actually a bug. There are
> several cases I would not like to expose my internal business
> interface out to the world, but if it was simply available through
> JNDI from another EAR running on the same domain. I think you might
> have found a bug =)
>
> Which version of GF are you running (3.0.1, 3.1)? I'm interested in
> testing this, as it has security implications for me.
>
> Thanks,
>
> S
>
> On Fri, Apr 15, 2011 at 3:24 PM, Xavier Callejas
> <xavier_at_sistemasaereos.com.sv <mailto:xavier_at_sistemasaereos.com.sv>>
> wrote:
>
> On Vie 15 Abr 2011 12:58:49 Jason Lee escribió:
> > I don't think you can do that. The Local interface is only
> accessible
> > inside the same application (which is your .ear).
>
> I could access using lookup but the returned instance by the
> lookup is a
> runtime generated proxy class witch I can examine by reflection,
> it has the
> same methods that the local interface and witch I can also call,
> but this is
> kind odd way to use the local bean.
>
> Bu the weird thing is that I could lookup the local bean from
> another EAR,
> and, by reflection, use its methods. So I supposed that if this is
> thecnical
> possible maybe is there another "standard" way to do this.
>
>