3 Replies Latest reply on Jan 2, 2009 10:49 PM by Ron Sigal

    JBoss AS 4.2.3.GA java.net.SocketException

    Sunil Babu Newbie

      I am using JBoss AS 4.2.3.GA and jboss-4.2.0.CR2 with ejb3.0. I have a remote client that calls the method in server using sslscoket and both servers will successfully print out the echo message.

      But If i try to call any method on 4.2.3 server from a remote client I will get a debug message about

      java.net.SocketException: Socket closed
       at java.net.PlainSocketImpl.socketAccept(Native Method)
       at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
       at java.net.ServerSocket.implAccept(ServerSocket.java:450)
       at java.net.ServerSocket.accept(ServerSocket.java:421)
       at org.jboss.remoting.transport.socket.SocketServerInvoker.run(SocketServerInvoker.java:520)
       at java.lang.Thread.run(Thread.java:595)



      On server I have

      package com.test;
      
      import javax.ejb.Stateless;
      import org.jboss.annotation.ejb.RemoteBinding;
      import org.jboss.annotation.ejb.RemoteBindings;
      
      
      @RemoteBindings({
       @RemoteBinding(clientBindUrl="sslsocket://0.0.0.0:3843", jndiBinding="test_SSL")
      })
      
      
      public @Stateless class TestFacadeBean implements TestFacade{
       public TestFacadeBean() {
       }
      
       public void echo() {
       System.out.println("Hello");
       }
      
      }


      package com.test;
      
      import javax.ejb.Remote;
      
      public @Remote interface TestFacade {
       public void echo();
      }


      Client side

      package com.test;
      
      import com.test.TestFacade;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;
      
      
      public class Client {
      
       private InitialContext ctx;
       private TestFacade testFacade= null;
      
       public Client {
       }
      
       public static void main(String[] arg) {
       try {
       Client client = new Client();
       client.ctx = new InitialContext();
       client.testFacade= (TestFacade) ctx.lookup("test_SSL");
       client.testFacade.echo();
       } catch (Exception ex) {
       }
       }
      
      }
      
      


        • 1. Re: JBoss AS 4.2.3.GA java.net.SocketException
          Ron Sigal Master

          I'm not following. Superficially,

          "sunilbabu" wrote:

          I have a remote client that calls the method in server using sslscoket and both servers will successfully print out the echo


          and

          "sunilbabu" wrote:

          But If i try to call any method on 4.2.3 server from a remote client I will get a debug message about ...


          seem to be contradictory. Could you clarify?



          • 2. Re: JBoss AS 4.2.3.GA java.net.SocketException
            Sunil Babu Newbie

            If I use 4.2.3 server I could see the socket exception in log file but if I use the same code in jboss-4.2.0.CR2 I don't see this in log file.

            I see this exception as a DEBUG log message and it is not directly affecting my application(ie, does not throw this exception in TestFacadeBean.java or Client.java).


            2008-12-29 23:56:09,504 DEBUG [org.jboss.remoting.transport.socket.ServerThread] WorkerThread#2[192.168.1.60:58092] closing socketWrapper: ServerSocketWrapper[17576e1[TLS_DHE_DSS_WITH_AES_128_CBC_SHA: Socket[addr=/192.168.1.60,port=58092,localport=3843]].17576e1]
            2008-12-29 23:56:09,504 DEBUG [org.jboss.remoting.transport.socket.ServerSocketWrapper] unable to writing CLOSING byte
            java.net.SocketException: Connection closed by remote host
             at com.sun.net.ssl.internal.ssl.SSLSocketImpl.checkWrite(SSLSocketImpl.java:1246)
             at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:43)
             at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
             at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
             at java.io.ObjectOutputStream$BlockDataOutputStream.flush(ObjectOutputStream.java:1631)
             at java.io.ObjectOutputStream.flush(ObjectOutputStream.java:666)
             at org.jboss.remoting.transport.socket.ServerSocketWrapper.close(ServerSocketWrapper.java:57)
             at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:520)
             at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:173)
            2008-12-29 23:56:09,504 DEBUG [org.jboss.remoting.transport.socket.SocketWrapper] unable to close output stream
            2008-12-29 23:56:09,504 DEBUG [org.jboss.remoting.transport.socket.SocketWrapper] ServerSocketWrapper[17576e1[TLS_DHE_DSS_WITH_AES_128_CBC_SHA: Socket[addr=/192.168.1.80,port=58092,localport=3843]].17576e1] closing
            2008-12-29 23:56:20,071 DEBUG [org.jboss.remoting.transport.socket.ClientSocketWrapper] reset timeout: 6000
            
            


            • 3. Re: JBoss AS 4.2.3.GA java.net.SocketException
              Ron Sigal Master

              The message is nothing to worry about, which is why it is logged at DEBUG level. When a socket is closed on the server side, an attempt is made to write a pair of bytes which are interpreted on the client side to mean that the connection should not be used. But if the client has already shut down ("java.net.SocketException: Connection closed by remote host"), then it doesn't matter if the pair of bytes can be written.