0 Replies Latest reply on Jun 2, 2017 9:12 AM by Joris Geuens

    Remote ejb client after local network failure or switch : Channel Channel ID has been closed --> auto reconnect possible?

    Joris Geuens Newbie

      Hello,

       

      We have some stateless Session Beans running on our Wildfly 10 cluster, which consists out of 2 nodes.

      Our customer connects with a fat client to our system.

      So they start the application, do their work.  But in case they have a laptop, they undock it from their desk to go to a meeting.  This will cause that the network is switched from a fixed line to wifi.  So the server is reachable on both networks.

      But when doing the next action in the open client (on the wifi network), it hangs for some long time and gives the following error : javax.ejb.EJBException: java.io.IOException: Channel Channel ID 96f5e5e9 (outbound) of Remoting connection 0685f468 to server-address/10.0.0.1:8080 of endpoint "config-based-ejb-client-endpoint" <37033acd> has been closed

      Also switching back from a wifi network to a fixed network gives the same error.

       

      Is it possible that if the local network is being reset locally on the client, the ejb client is able to detect this and reconnect to the cluster for a lookup of the EJB?

       

      Thanks in advance!

       

      Joris

       

       

       

      public class TestClient {
      
         public static void main(String[] args) {
         try {
         initInitialContext("cluster-address", "8180", "username", "pw");
        Context ctx = getInitialContext();
      
        BeanInterface beanInterface = (BeanInterface) ctx.lookup("ejb:ear-1.0.0/module-1.0.0/BeanInterface!package.BeanInterface");
      
        System.out.println(beanInterface.findAll().size());
      
      
        ctx.close();
      
        } catch (Exception e) {
        System.out.println(e.getMessage());
        } 
        }
      
         public static void initInitialContext(String host, String port, String username, String password) throws NamingException {
        Properties props = new Properties();
        props.put("remote.connections", "default");
        props.put("remote.connection.default.port", port);
        props.put("remote.connection.default.host", host);
        props.put("remote.connection.default.username", username);
        props.put("remote.connection.default.password", password);
        props.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");
        props.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
        props.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
        props.put("deployment.node.selector", "com.vangenechten.commons.util.RoundRobinNodeSelector");
         props.put("remote.clusters", "ejb");
        props.put("remote.cluster.ejb.username", username);
        props.put("remote.cluster.ejb.password", password);
        props.put("remote.cluster.ejb.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");
        props.put("remote.cluster.ejb.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
        props.put("remote.cluster.ejb.clusternode.selector", "com.vangenechten.commons.util.RoundRobinClusterNodeSelector");
      
        EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(props);
        ContextSelector<EJBClientContext> contextSelector = new ConfigBasedEJBClientContextSelector(ejbClientConfiguration);
        EJBClientContext.setSelector(contextSelector);
        }
      
         public static Context getInitialContext() throws NamingException {
        Properties properties = new Properties();
        properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
        properties.put("jboss.naming.client.ejb.context", "true");
         return new InitialContext(properties);
        }
      
      
      }
      

       

      javax.ejb.EJBException: java.io.IOException: Channel Channel ID 96f5e5e9 (outbound) of Remoting connection 0685f468 to server-address/10.0.0.1:8080 of endpoint "config-based-ejb-client-endpoint" <37033acd> has been closed

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

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

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

           at com.sun.proxy.$Proxy8.findByCriteria(Unknown Source)

           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

           at java.lang.reflect.Method.invoke(Method.java:497)

           at com.vangenechten.commons.j2ee.EJB3RemoteInvocationHelper.invoke(EJB3RemoteInvocationHelper.java:45)

           at com.sun.proxy.$Proxy8.findByCriteria(Unknown Source)

           at com.vangenechten.ictmanager.client.timeregistration.standard.StandardDayAction.execute(StandardDayAction.java:73)

           at com.vangenechten.swing.action.SwingAction.actionPerformed(SwingAction.java:295)

           at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)

           at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)

           at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)

           at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)

           at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)

           at java.awt.Component.processMouseEvent(Component.java:6525)

           at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)

           at java.awt.Component.processEvent(Component.java:6290)

           at java.awt.Container.processEvent(Container.java:2234)

           at java.awt.Component.dispatchEventImpl(Component.java:4881)

           at java.awt.Container.dispatchEventImpl(Container.java:2292)

           at java.awt.Component.dispatchEvent(Component.java:4703)

           at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)

           at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)

           at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)

           at java.awt.Container.dispatchEventImpl(Container.java:2278)

           at java.awt.Window.dispatchEventImpl(Window.java:2750)

           at java.awt.Component.dispatchEvent(Component.java:4703)

           at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)

           at java.awt.EventQueue.access$500(EventQueue.java:97)

           at java.awt.EventQueue$3.run(EventQueue.java:709)

           at java.awt.EventQueue$3.run(EventQueue.java:703)

           at java.security.AccessController.doPrivileged(Native Method)

           at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

           at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)

           at java.awt.EventQueue$4.run(EventQueue.java:731)

           at java.awt.EventQueue$4.run(EventQueue.java:729)

           at java.security.AccessController.doPrivileged(Native Method)

           at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

           at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)

           at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)

           at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)

           at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)

           at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)

           at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)

           at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

      Caused by: java.io.IOException: Channel Channel ID 96f5e5e9 (outbound) of Remoting connection 0685f468 to server-address/10.0.0.1:8080 of endpoint "config-based-ejb-client-endpoint" <37033acd> has been closed

           at org.jboss.ejb.client.remoting.ChannelAssociation$1.handleClose(ChannelAssociation.java:123)

           at org.jboss.ejb.client.remoting.ChannelAssociation$1.handleClose(ChannelAssociation.java:115)

           at org.jboss.remoting3.spi.SpiUtils.safeHandleClose(SpiUtils.java:54)

           at org.jboss.remoting3.spi.AbstractHandleableCloseable$CloseHandlerTask.run(AbstractHandleableCloseable.java:514)

           at org.jboss.remoting3.spi.AbstractHandleableCloseable.runCloseTask(AbstractHandleableCloseable.java:419)

           at org.jboss.remoting3.spi.AbstractHandleableCloseable.closeComplete(AbstractHandleableCloseable.java:290)

           at org.jboss.remoting3.remote.RemoteConnectionChannel.closeReadsAndWrites(RemoteConnectionChannel.java:274)

           at org.jboss.remoting3.remote.RemoteConnectionChannel.closeAction(RemoteConnectionChannel.java:534)

           at org.jboss.remoting3.spi.AbstractHandleableCloseable.closeAsync(AbstractHandleableCloseable.java:372)

           at org.jboss.remoting3.remote.RemoteConnectionHandler.closeAllChannels(RemoteConnectionHandler.java:444)

           at org.jboss.remoting3.remote.RemoteConnectionHandler.receiveCloseRequest(RemoteConnectionHandler.java:218)

           at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:452)

           at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:46)

           at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)

           at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:198)

           at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:112)

           at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)

           at org.xnio.ChannelListeners$DelegatingChannelListener.handleEvent(ChannelListeners.java:1092)

           at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)

           at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)

           at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)

           at org.xnio.nio.WorkerThread.run(WorkerThread.java:567)