4 Replies Latest reply on Jun 9, 2012 12:58 AM by jaikiran

    EJB reconnect issue between 2 servers with 7.1.1.Final

    jasipher

      Server A hosts an EAR containing one stateless EJB.

      Server B hosts an EAR containing multiple web applications and EJBs.

       

      The EJB on server A uses 3 of the EJBs hosted on server B.

       

      One of the web apps on server B uses the EJB on server A plus several of the EJBs on server B.

       

      When I first start both servers everything works fine.

       

      If I restart server A, the web app on server B is able to reconnect to the EJB on server A without any problem, but when the EJB on server A tries to connect to one of the EJBs on server B it fails with an InvocationTargetException caused by my new favorite problem

       

      java.lang.IllegalStateException: No EJB receiver available for handling [appName:myapp,modulename:mymodule,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@4452bcae

          at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)

          at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119)

          at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)

          at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)

          at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)

          at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)

          at $Proxy99.create(Unknown Source)          ... 38 more

       

      If I restart server B the reverse is true - server A is able to reconnect to the EJBs on server B, but the web app on server B gets the ever popular "No EJB receiver available..." message when it tries to use the EJB on server A.

       

      jboss-ebj-clilent.xml on server A looks like this:

      <jboss-ejb-client xmlns="urn:jboss:ejb-client:1.0">

          <client-context>

              <ejb-receivers>

                  <remoting-ejb-receiver outbound-connection-ref="serverb-connector"/>

              </ejb-receivers>

          </client-context>

      </jboss-ejb-client>

       

      and on server B it looks like this:

      <jboss-ejb-client xmlns="urn:jboss:ejb-client:1.0">

          <client-context>

              <ejb-receivers>

                  <remoting-ejb-receiver outbound-connection-ref="servera-connector"/>

              </ejb-receivers>

          </client-context>

      </jboss-ejb-client>

       

      The result is that if I have to restart one server I have to restart both, and that's not a good solution.

       

      Any suggestions for working around this would really be appreciated.

        • 1. Re: EJB reconnect issue between 2 servers with 7.1.1.Final
          jaikiran

          John, welcome to the forums!

           

          That looks weird. I'll take a look at this sometime later today/tomorrow. But in the meantime, can you do a quick check against AS7 nightly build to see if it's reproducible there https://community.jboss.org/thread/167590

          • 2. Re: EJB reconnect issue between 2 servers with 7.1.1.Final
            jaikiran

            By the way, the reason why I say it's weird is because your problem description seems to indicate that the server which was restarted is unable to communicate with a server which was never shutdown:

            If I restart server A, the web app on server B is able to reconnect to the EJB on server A without any problem, but when the EJB on server A tries to connect to one of the EJBs on server B it fails with an InvocationTargetException caused by my new favorite problem

            I could understand if it was the other way around - i.e. the server which is still up not being able to connect to a restarted server, since it was a bug in 7.1.1 which we fixed and is available in nightly build https://issues.jboss.org/browse/AS7-4510

            • 3. Re: EJB reconnect issue between 2 servers with 7.1.1.Final
              jasipher

              Good news - it looks as if it works in the nightly build. The bad news for me is that I can only use the released version.

               

              And, it looks like I misunderstood the problem. The real issue is that whichever server is started last can't reconnect when the other is restarted. In other words, the reconnect fails if the very first attempt to connect to the remote EJB succeeded. If the first attempt fails (because the other server isn't started yet) then the reconnect works fine from that point forward.

               

              Is there any way that I can add whichever patch fixed that to my 7.1.1.Final environment? I think our product managment and QA folks would be more comfortable with 7.1.1.Final plus some specific patch than with a snapshot build.

               

              Thanks for the quick reply to the question. I've found solutions for most of my AS 7 issues in the forums, and most of those were your answers.

              • 4. Re: EJB reconnect issue between 2 servers with 7.1.1.Final
                jaikiran

                John Sipher wrote:

                 

                 

                Is there any way that I can add whichever patch fixed that to my 7.1.1.Final environment? I think our product managment and QA folks would be more comfortable with 7.1.1.Final plus some specific patch than with a snapshot build.

                 

                I believe this is the patch https://github.com/jbossas/jboss-as/pull/2050/commits you'll need to apply on 7.1.1.Final. So you'll have to first get the 7.1.1.Final source tag https://github.com/jbossas/jboss-as/tree/7.1.1.Final and then apply that patch and do a build. Or you can actually build the 7.1.2.Final tag https://github.com/jbossas/jboss-as/tree/7.1.2.Final which already contains this fix. I would recommend building the 7.1.2.Final tag since it also has other bug fixes which you might benefit from.

                 

                 

                John Sipher wrote:

                 

                Thanks for the quick reply to the question. I've found solutions for most of my AS 7 issues in the forums, and most of those were your answers.

                Good to know!