EJB References

Discussions

EJB programming & troubleshooting: EJB References

  1. EJB References (2 messages)

    Hi guys

    Am developing a EJB sample app, where one EJB calls another EJB, but I haven't been able to get it work.From what I've read, I only need to change my deployment descriptor and code in the way I described bellow.

    Following is a snippet of both the code and the deployment descriptor:

    Scenario:
    Have a Machine Session ( stateless ) bean which builds Components session (stateful ) beans

    Code:

    InitialContext ctx = new InitialContext();
    Object result = ctx.lookup("java:comp/env/ejb/ComponentHome");
                ComponentHome home = (ComponentHome) javax.rmi.PortableRemoteObject.narrow(result,ComponentHome.class);

    Deployment descriptor:

         <session id="Machine">
    <display-name>Machine</display-name>
    <ejb-name>Machine</ejb-name>
    <home>MachineHome</home>
    <remote>Machine</remote>
    <ejb-class>MachineBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    <ejb-ref>
            <description>This is a ejb reference, i.e a Machine bean uses a Component</description>
               <ejb-ref-name>ejb/ComponentHome</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>ComponentHome</home>
    <remote>Component</remote>
    </ejb-ref>
        </session>

    Any hints? I really appreciate any shed of light here ;-)
    peace
    P

    Threaded Messages (2)

  2. EJB References[ Go to top ]

    Have you taken care of the vendor specific XML where you point ejb/ComponentHome from <ejb-ref-name> to the *real* JNDI name? e.g. in WLS

        <ejb-reference-description>
          <ejb-ref-name>ejb/ComponentHome</ejb-ref-name>
          <jndi-name>com.foo.ComponentHome</jndi-name>
        </ejb-reference-description>
  3. EJB References[ Go to top ]

    Hi Dion

    thanks for your reply. I am using WAS 4.0. Have you worked with it? if so, I would really appreciate if you can give a hand here or any other info i could look into...
    thanks
    P