users@glassfish.java.net

Re: an EJB2.1 stateless session bean with remote and local interface -- how

From: <glassfish_at_javadesktop.org>
Date: Sat, 12 Jan 2008 10:17:20 PST

> I see you are doing the lookup from a JSF. I am not
> sure how JNDI lookup's work with JSF components, but
> as they're in the Web container I assume it uses the
> ejb-ref definitions in web.xml. The ejb-ref and
> ejb-local-ref definitions in ejb-jar.xml are
> definitely ignored.

Hi Dies... The JNDI lookup is not being done from the web module (i.e., dddEAR-war.war)...

The JNDI lookup is being done from the POJO (i.e., "ddd.ejb.DddHelper.java")... which resides in the same package as the stateless session bean (i.e., "ddd.ejb.DddEJBBean.java").

To clarify further, the POJO in the web module (i.e., "ddd.web.WelcomeJSFBean.java") simply imports "ddd.ejb.DddHelper", instantiates a DddHelper object, and a calls a function on that DddHelper object which itself performs the JNDI lookup of the session bean.



[code]



                                    (POJO)
----(web module)---A---ddd.web.WelcomeJSFBean/getField1()----------
            | ^
            | |
            | |
     instantiate DddHelper |
     call: DddHelper/getField1 (return value)
            | |
            | |
            V (POJO) |
----(ejb module)---B---ddd.ejb.DddHelper/getField1-----------------
            | ^
            | |
            | |
      lookup DddEJBLocalHome (EJB) |
      call: DddEJBBean/getField1 (return value)
            | |
            | |
            V (EJB) |
----(ejb module)---C---ddd.ejb.DddEJBBean/getField1()---------------

[/code]





-- Since the POJO in the web module -- WelcomeJSFBean.java -- does not perform a JNDI lookup, I dont believe configuring sun-web.xml for a JNDI lookup would be necessary.

(Note that I added extra notes in my previous post to make this more obvious)

Let me know what you think.

Thanks

sd
[Message sent by forum member 'sairndain' (sairndain)]

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