ejb@glassfish.java.net

Re: Local Lookup Problem

From: Kenneth Saks <Kenneth.Saks_at_Sun.COM>
Date: Tue, 02 Dec 2008 11:41:13 -0500

On Dec 2, 2008, at 11:13 AM, burak sevindi wrote:

> Hello,
>
> I have read the EJB FAQ page but cannot find a solution to my
> problem. I am using Struts 2 and Glassfish and need to access a
> local session bean from a struts action class. My struts action
> class resides on the same container with the local session bean. So
> is there a way to access a local bean from an unmanaged class if
> they both reside on the same container?

Hi Burak,

The relevant entry is https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
#POJOLocalEJB

The struts classes need to be in a .war that is in the same .ear as
the local session beans.
You'll need to either declare the local ejb ref using @EJB on some
managed class (e.g. a servlet) in the .war
or declare an ejb-local-ref in web.xml. Then, do a lookup relative
to java:comp/env from your struts class.

>
>
> Thx in advance,
>
> -b