java.nio.channels.ClosedChannelException - org.xnio.ssl.JsseSslConduitEngine.handleHandshake with EJB client trying to connect with SSL to JBoss EAP 7

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.x

Issue

java.nio.channels.ClosedChannelException - org.xnio.ssl.JsseSslConduitEngine.handleHandshake with EJB client trying to connect with SSL to JBoss EAP 7

WARN  [org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector] (ServerService Thread Pool -- 78) Could not register a EJB receiver for connection to 127.0.0.1:8443: java.nio.channels.ClosedChannelException
  at org.xnio.ssl.JsseSslConduitEngine.handleHandshake(JsseSslConduitEngine.java:530)
  at org.xnio.ssl.JsseSslConduitEngine.wrap(JsseSslConduitEngine.java:314)
  at org.xnio.ssl.JsseSslConduitEngine.wrap(JsseSslConduitEngine.java:204)
  at org.xnio.ssl.JsseSslStreamSinkConduit.write(JsseSslStreamSinkConduit.java:98)
  at org.xnio.ssl.JsseSslStreamSinkConduit.write(JsseSslStreamSinkConduit.java:72)
  at org.xnio.conduits.ConduitStreamSinkChannel.write(ConduitStreamSinkChannel.java:150)
  at org.xnio.http.HttpUpgrade$HttpUpgradeState$StringWriteListener.handleEvent(HttpUpgrade.java:385)
  at org.xnio.http.HttpUpgrade$HttpUpgradeState$StringWriteListener.handleEvent(HttpUpgrade.java:372)
  at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
  at org.xnio.conduits.WriteReadyHandler$ChannelListenerHandler.writeReady(WriteReadyHandler.java:65)
  at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:94)
  at org.xnio.nio.WorkerThread.run(WorkerThread.java:571)
  at ...asynchronous invocation...(Unknown Source)
  at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:294)
  at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:430)
  at org.jboss.ejb.client.remoting.EndpointPool$PooledEndpoint.connect(EndpointPool.java:192)
  at org.jboss.ejb.client.remoting.NetworkUtil.connect(NetworkUtil.java:153)
  at org.jboss.ejb.client.remoting.NetworkUtil.connect(NetworkUtil.java:133)
  at org.jboss.ejb.client.remoting.ConnectionPool.getConnection(ConnectionPool.java:78)
  at org.jboss.ejb.client.remoting.RemotingConnectionManager.getConnection(RemotingConnectionManager.java:51)
  at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.setupEJBReceivers(ConfigBasedEJBClientContextSelector.java:161)
  at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.getCurrent(ConfigBasedEJBClientContextSelector.java:118)
  at org.jboss.ejb.client.naming.ejb.EjbNamingContext.createIdentifiableEjbClientContext(EjbNamingContext.java:269)
  at org.jboss.ejb.client.naming.ejb.EjbNamingContext.setupScopedEjbClientContextIfNeeded(EjbNamingContext.java:134)
  at org.jboss.ejb.client.naming.ejb.EjbNamingContext.<init>(EjbNamingContext.java:101)
  at org.jboss.ejb.client.naming.ejb.ejbURLContextFactory.getObjectInstance(ejbURLContextFactory.java:38)
  at org.jboss.as.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:133)
  at javax.naming.InitialContext.lookup(InitialContext.java:417)
...

Resolution

Configure JBoss frontend server to connect to the backend JBoss server for EJBs with SSL enabled

This looks like the client-side:

      <subsystem xmlns="urn:jboss:domain:remoting:3.0">
        <outbound-connections>
          <remote-outbound-connection name="remote-ejb-connection" outbound-socket-binding-ref="ejb-outbound" username="ejbuser" security-realm="MyRealm">
            <properties>
              <property name="SASL_POLICY_NOANONYMOUS" value="false"></property>
              <property name="SSL_ENABLED" value="true"></property>
            </properties>
          </remote-outbound-connection>
        </outbound-connections>

The server side:

            <subsystem xmlns="urn:jboss:domain:remoting:3.0">
                <http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>
            </subsystem>

Diagnostic Steps

  1. Enable debug logging via -Djavax.net.debug=ssl,handshake which you can put in the system-properties on your server instances in the host.xml.
  2. Get the full logs from both the server and client-side.
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.