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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content