2 Replies Latest reply on Jun 25, 2013 4:40 PM by pedrokowalski

    Reconnection of remote EJB Client after server restart

    pedrokowalski

      Hi everyone,

       

      I've started this talk on IRC. The problem is as follows:

       

      1. Server starts,

      2. Client starts,

      3. Client successfully invokes remote EJB's on server,

      4. Server restarts (client is still running),

      5. Client cannot invoke remote EJB's on server.

       

      The following exception is:

       

      Caused by: java.lang.IllegalStateException: No EJB receiver available for handling [appName:my.app.ea,modulename:my.app.facade,distinctname:] combination
          at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:485)
          at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:84)
          at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:175)
          at com.example.client.serveraccess.UserContextClientInterceptor.handleInvocation(UserContextClientInterceptor.java:37)
          at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:175)
          at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:122)
          at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:107)
          at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:90)
          at com.sun.proxy.$Proxy128.getArchivingTemplates(Unknown Source)
          at com.example.client.topologybrowser.ui.widget.ArchivingTemplateWidgetContext.getArchiveTemplates(ArchivingTemplateWidgetContext.java:103)
          ... 49 more
      

       

      EJB Client properties (jboss-ejb-client.properties):

       

      remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
      remote.connections=default
      
      remote.connection.default.host=${server.address}
      remote.connection.default.port=4447
      remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
      remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false
      
      remote.connection.default.username=${jboss.user}
      remote.connection.default.password=${jboss.pass}
      
      


       

      EJB Client code (standalone app):

       

       

      propertiesInputStream = this.getClass().getClassLoader().getResourceAsStream( "jboss-ejb-client.properties" );
      
      final Properties ejbClientProperties = new Properties();
      ejbClientProperties.load( propertiesInputStream );
      final EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration( ejbClientProperties );
      final ContextSelector< EJBClientContext > selector = new ConfigBasedEJBClientContextSelector( cc );
      EJBClientContext.setSelector( selector );
      EJBClientContext.getCurrent().registerInterceptor( 0, new UserContextClientInterceptor( aUserName ) );
      
      final Properties props = new Properties();
      props.put( Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming" );
      context = new InitialContext( props );
      
      

       

      UserContextClientInterceptor is responsible for sending username from client to server (it's retrieved on Server-side EJB interceptor).

       

      I'm working on JBoss EAP 6.1 Alpha. All remote ejb client maven dependencies are taken from:

       

      <dependencies>
              <dependency>
                  <groupId>org.jboss.as</groupId>
                  <artifactId>jboss-as-ejb-client-bom</artifactId>
                  <version>${jboss.version}</version>
                  <type>pom</type>
                  <scope>import</scope>
              </dependency>
      </dependencies>
      
      

       

      The funny thing is - sometime ago (when I wasn't using username and password in jboss-ejb-client.properties) it was working correctly. After server restart the client was able to invoke remote EJBs.

       

      Thanks in advance for your help.

        • 1. Re: Reconnection of remote EJB Client after server restart
          jaikiran

          Can you please enable TRACE level logs of org.jboss.ejb.client package on the client side and attach those logs along with the entire exception stacktrace in that log?

          • 2. Re: Reconnection of remote EJB Client after server restart
            pedrokowalski

            Sorry for such a late answer. I was on my vacations and in the meanwhile my colleagues worked on different part of the system that involved JMS.

            Somehow (by developing mechanism for obtaining fresh JMS Connection Factory after server-shutdown and startup) problem of remote EJB reconnection was automatically solved...

             

            It seems that they're doing a JMS ConnectionFactory lookup (once again after server shutdown) which must have somehow 'reinitialized' the whole EJB Client.

             

            Nevertheless, the problem is no longer valid.

             

            Thanks for the effort!

             

            All the best,

            Piotr