users@glassfish.java.net

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

From: Steven Siebert <smsiebe_at_gmail.com>
Date: Thu, 21 Apr 2011 12:16:56 -0400

Sahoo,

You are absolutely right! I re-read the spec and indeed section 3.2.2
spells this out quite clearly. I'm not sure when my misunderstanding was
introduced, but I thank you for correcting me. =)

"Access to an enterprise bean through the local client view is only required
to be supported for local clients packaged within the same application as
the enterprise bean that provides the local client view. Compliant
implementations of this specification may optionally support access to the
local client view of an enterprise bean from a local client packaged in a
different application. The configuration requirements for inter-application
access to the local client view are vendor-specific and are outside the
scope of this specification. Applications relying on inter-application
access to the local client view are non-portable."

Thanks!

S

On Sat, Apr 16, 2011 at 7:56 PM, Sahoo <sanjeeb.sahoo_at_oracle.com> wrote:

> 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> 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.
>>
>>
>
>