0 Replies Latest reply on May 20, 2005 3:17 AM by Michael Frick

    custom RMI SocketFactory

    Michael Frick Newbie

      I implemented a simple SocketFactory which creates a compressing socket using GZipInput/OutputStream.

      I added the following to jboss-service.xml:

      <mbean code="org.jboss.invocation.jrmp.server.JRMPInvoker"
       name="jboss:service=invoker,type=jrmp">
       <attribute name="RMIObjectPort">4444</attribute>
       <attribute name="RMIClientSocketFactory">
       foo.bar.MyClientCompressionSocketFactory
       </attribute>
       <attribute name="RMIServerSocketFactory">
       foo.bar.MyServerCompressionSocketFactory
       </attribute>
       <depends>jboss:service=TransactionManager</depends>
      </mbean>


      When trying to invoke a method, i get a EOFException:

      ...
      Caused by: java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
       java.io.EOFException
       at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:274)
       at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
       at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
       at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
       at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:118)
       at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:163)
       at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:103)
       at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
       at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
       at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:169)
       at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:91)
       at $Proxy0.create(Unknown Source)
       ... 35 more
      Caused by: java.io.EOFException
       at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:200)
       at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:190)
       at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:130)
       at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:58)
       at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:68)
       at foo.bar.MyCompressionSocket.getInputStream(PECompressionSocket.java:64)
       at sun.rmi.transport.tcp.TCPConnection.getInputStream(TCPConnection.java:85)
       at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:213)
       ... 46 more


      Any ideas, what is wrong in my config or implementation?