Can I have recursive EJB create calls in the setSessionContext method in JBoss?

Solution Verified - Updated -

Issue

Scenario:

Here is the test case class to test the EJB function:

TestInShIntegrationSB.java

InShLaIntegrationSBHome inShLaIntegrationSBHome = (InShLaIntegrationSBHome)context.lookup(InShLaIntegrationSBHome.JNDI_NAME);

InShLaIntegrationSB iSB = inShLaIntegrationSBHome.create();

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

InShLaIntegrationSBBean.java

     public void setSessionContext(SessionContext arg0) throws EJBException,
               RemoteException {
          // TODO Auto-generated method stub
          this.sessionContext = sessionContext;

        try {
            inLaSFHome = (LaSFHome) findEJBRemoteHome(inLaSFHome,
                      LaSFHome.JNDI_NAME, LaSFHome.class);

             //Error happern here  
            inLaSF = inLaSFHome.create();

        }
        catch (Exception e) {
            throw new EJBException(e);
        }
     }

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

LaSFBean.java

public void setSessionContext(SessionContext sessionContext)
               throws EJBException, RemoteException {
          // TODO Auto-generated method stub
          this.sessionContext = sessionContext;
          try {
               findInLaEBLocalHome();
                        //Call back the ShLaIntegrationSBBean
                        //Error happern here
               findInShLaIntegrationSBRemote();
               inShLaIntegrationSB = inShLaIntegrationSBHome.create();
          } catch (Exception e) {
               throw new EJBException(e.getMessage());
          }

     }

Question:

TestInShIntegrationSB  call InShLaIntegrationSBBean,
InShLaIntegrationSBBean call LaSF,
LaSF call InShLaIntegrationSBBean.

All this call just initialize the session context and create method for the SF.

Server show run time error with looping.

Environment

JBoss Enterprise Application Platform (EAP) 4.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.