0 Replies Latest reply on Feb 25, 2011 12:16 PM by ibstmt

    Getting two @EJBs to work together

    ibstmt Newbie

      Consider the following two EJBs:

      public class EjbTwo {
      EjbTwo ejbTwo;
      public void doSomething() {

      public class EjbOne {
      public void load(){
      // initialize a bunch of stuff
      public void doSomethingElse() {
      // do something

      When my page loads, EjbOne is created properly, and EjbTwo is created.  My page also has some direct references to EjbTwo. For example:


      All of that works correctly. If my page calls methods in EjbOne, no problem. If it calls methods in EjbTwo, no problem. My problem is when my page tries to invoke the doSomething method on EjbOne, which in turn tries to call a method in EjbTwo:


      If I trace the code, I'm in ejbOne.doSomething. If I then continue into ejbTwo.doSomethingElse, it seems to be a different instance of EjbTwo. All of the class variables are null, and it's definitely not the same instance as when my page references EjbTwo directly.

      What am I doing wrong?