users@glassfish.java.net

lookup other EJB from one EJB within same EAR

From: <glassfish_at_javadesktop.org>
Date: Fri, 05 Sep 2008 10:14:47 PDT

In my EAR, I have several Stateful Session Beans(SFSB). Methods of an SFSB can return multiple references/handles to other SFSB.
I am using intitial context lookup method to lookup other SFSB from original SFSB.

Now the problem:
[b]I do not want to hard-code the Global JNDI of SFSBs in my lookup code, to keep my code independent of deployment environment.[/b]

Solutions I tried
1. EJB injection:
        I think it is not a right fit. because If I do EJB injection(for other SFSB) in my SFSB, all methods(of my first SFSB) will have reference to same SFSB, that I do not want. I want each method to generate new SFSB.

2. using ejb-ref in ejb-jar.xml
        
        <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
                 version="3.0"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
        <enterprise-beans>
                <session>
                        <ejb-name>SFSB1</ejb-name>
                        [b]<ejb-ref>
                                <ejb-ref-name>MySFSB2</ejb-ref-name>
                                <ejb-ref-type>Session</ejb-ref-type>
                                <ejb-link>SFSB2</ejb-link>
                        </ejb-ref>[/b] </session>
        </enterprise-beans>

I have annotated other SFSB with name = "SFSB2", see below code snippet

        @Remote(SFSB2Interface.class)
        @Stateful(name = "SFSB2")
        public class SFSB2Impl implements SFSB2Interface

Error:
I get weired problem when I try to deploy to glassfish (Sun app server 9.1_02(build b04-fcs)):
[b]Warning : Unable to determine local business vs. remote business designation for EJB 3.0 ref Unresolved Ejb-Ref MySFSB2_at_jndi: @null_at_null@Session_at_SFSB2[/b]

Am I missing anything here? Any suggestion is appreciated. thanks
[Message sent by forum member 'praveen16' (praveen16)]

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