Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-17086

[GSS](7.2.z) UNDERTOW-1580 - Improve EJB over HTTPS logging

XMLWordPrintable

      When an EJB client is using EJB over HTTPS and does not have the truststore set, it fails with java.nio.channels.ClosedChannelException and no indication of the issue.

        public static Context getHttpInitialContext(String protocol, String host, Integer port, String username, String password, String servicesPath) throws NamingException {
         if(servicesPath == null)
            servicesPath = "wildfly-services";
         Properties props = new Properties();
         props.put(Context.INITIAL_CONTEXT_FACTORY,  "org.wildfly.naming.client.WildFlyInitialContextFactory");
         // https://localhost:8080/wildfly-services
         props.put(Context.PROVIDER_URL, String.format("%s://%s:%d/%s", protocol, host, port, servicesPath));
         if(username != null && password != null) {
            props.put(Context.SECURITY_PRINCIPAL, username);
            props.put(Context.SECURITY_CREDENTIALS, password);
          }   
         return new InitialContext(props);
        }
      
           [java] javax.ejb.EJBException: java.nio.channels.ClosedChannelException
           [java] 	at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocatINFO  
           [java] 	at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:112)
           [java] 	at com.sun.proxy.$Proxy0.sayHello(Unknown Source)
           [java] 	at com.jboss.examples.ejb.HelloClient.test(HelloClient.java:49)
           [java] 	at com.jboss.examples.ejb.HelloClient.main(HelloClient.java:42)
           [java] Caused by: java.nio.channels.ClosedChannelException
           [java] 	at io.undertow.client.http2.Http2ClientConnection.handleEvent(Http2ClientConnection.java:107)
           [java] 	at io.undertow.client.http2.Http2ClientConnection.handleEvent(Http2ClientConnection.java:99)
           [java] 	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
           [java] 	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:1061)
           [java] 	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:975)
           [java] 	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
           [java] 	at io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.terminated(SslConduit.java:1214)
           [java] 	at org.xnio.nio.NioSocketConduit.readTerminated(NioSocketConduit.java:332)
           [java] 	at org.xnio.nio.NioSocketStreamConnection.notifyReadClosed(NioSocketStreamConnection.java:148)
           [java] 	at org.xnio.Connection.close(Connection.java:139)
           [java] 	at org.xnio.IoUtils.safeCl localhost:8443
           [java] INFO  [HelloClient] Test lookup: ejb:/ejb-client/Hello!com.jboss.examples.ejb.Hello -> failed
           [java] ose(IoUtils.java:152)
           [java] 	at io.undertow.protocols.ssl.SslConduit.closed(SslConduit.java:1046)
           [java] 	at io.undertow.protocols.ssl.SslConduit.close(SslConduit.java:1117)
           [java] 	at io.undertow.protocols.ssl.SslConduit.doUnwrap(SslConduit.java:820)
           [java] 	at io.undertow.protocols.ssl.SslConduit.doHandshake(SslConduit.java:648)
           [java] 	at io.undertow.protocols.ssl.SslConduit.access(SslConduit.java:63)
           [java] 	at io.undertow.protocols.ssl.SslConduit.run(SslConduit.java:1084)
           [java] 	at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612)
           [java] 	at org.xnio.nio.WorkerThread.run(WorkerThread.java:479)
      

      If the client has a truststore, but URL: http://localhost:8443 , then it fails with:

           [java] javax.ejb.EJBException: java.io.IOException: Connection reset by peer
           [java] 	at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:207)
           [java] 	at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:112)
           [java] 	at com.sun.proxy.$Proxy0.sayHello(Unknown Source)
           [java] 	at com.jboss.examples.ejb.HelloClient.test(HelloClient.java:53)
           [java] 	at com.jboss.examples.ejb.HelINFO  [HelloClient] Test lookup: ejb:/ejb-client/Hello!com.jboss.examples.ejb.Hello -> failed
           [java] loClient.main(HelloClient.java:46)
           [java] Caused by: java.io.IOException: Connection reset by peer
           [java] 	at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
           [java] 	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
           [java] 	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
           [java] 	at sun.nio.ch.IOUtil.read(IOUtil.java:192)
           [java] 	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
           [java] 	at org.xnio.nio.NioSocketConduit.read(NioSocketConduit.java:289)
           [java] 	at org.xnio.conduits.PushBackStreamSourceConduit.read(PushBackStreamSourceConduit.java:52)
           [java] 	at org.xnio.conduits.ConduitStreamSourceChannel.read(ConduitStreamSourceChannel.java:127)
           [java] 	at io.undertow.client.http.HttpClientConnection$ClientReadListener.handleEvent(HttpClientConnection.java:553)
           [java] 	at io.undertow.client.http.HttpClientConnection$ClientReadListener.handleEvent(HttpClientConnection.java:516)
           [java] 	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
           [java] 	at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
           [java] 	at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
           [java] 	at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
      

              rhn-support-tmiyargi Teresa Miyar Gil (Inactive)
              rhn-support-bmaxwell Brad Maxwell
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: