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

    Reconnection of remote EJB Client after server restart

    Piotr Nowicki Newbie

      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.