ORMI Client Spins With RMIConnectionException And CommunicationException

(Doc ID 747480.1)

Last updated on MARCH 08, 2017

Applies to:

Oracle Containers for J2EE - Version: 10.1.3.3.0 and later   [Release: AS10gR3 and later ]
Information in this document applies to any platform.
***Checked for relevance on 27-Aug-2011***

Symptoms

An ORMI client passing an object instance of a class with a different serialVersionUID than the class used on the server side makes the client report a lot of exceptions, establish many new socket connections and likely spin for many iterations before it terminates.

 

For example a  client application calls following session bean method remotely:

public ComplexObject loadComplexObject(ComplexObject complexObject) {
  System.out.println("Server version ID: " +
  ObjectStreamClass.lookup(ComplexObject.class).getSerialVersionUID());
return new ComplexObject();
}

The class for the parameter looks like this:

public class ComplexObject implements Serializable {
  private static final long serialVersionUID = 1;

  public ComplexObject() {
  }
}

The class ComplexObject used by the client has a different serialVersionUID than the class on the server side.

In this case the client will show errors like the following:

08-Oct-2008 22:41:32 oracle.j2ee.rmi.RMIMessages EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER
WARNING: Exception returned by remote server: {0}
com.evermind.server.rmi.RMIConnectionException: Disconnected: serializationbug.ComplexObject; local class incompatible: stream classdesc serialVersionUID = 1, local class serialVersionUID = 2 
  at com.evermind.server.rmi.RmiCallQueue.notifyQueuedThreadsRmiCallQueue.java:70)
  at com.evermind.server.rmi.RMIClientConnection.notifyQueuedThreads(RMIClientConnection.java:208)
  at com.evermind.server.rmi.RMIClientConnection.resetState(RMIClientConnection.java:147)
  at com.evermind.server.rmi.RMIConnection.receiveDisconnect(RMIConnection.java:236)
  at com.evermind.server.rmi.RMIClientConnection.receiveDisconnect(RMIClientConnection.java:176)
  at com.evermind.server.rmi.RMIConnection.handleOrmiCommand(RMIConnection.java:208)
  at com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RMIClientConnection.java:276)
  at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:152)
  at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)
  at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
  at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:830)
  at java.lang.Thread.run(Thread.java:595)
... (above exception repeats many times) ...
oracle.oc4j.rmi.OracleRemoteException: Unable to failover 
  at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.getReplacementObject(RecoverableRemoteInvocationHandler.java:68)
  at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.handleRecovery(RecoverableRemoteInvocationHandler.java:41)
  at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:30)
  at com.evermind.server.ejb.StatefulSessionRemoteInvocationHandler.invoke(StatefulSessionRemoteInvocationHandler.java:31)
  at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.handleRecovery(RecoverableRemoteInvocationHandler.java:49)
... (repeating many times) ...
  at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:30) 
  at com.evermind.server.ejb.StatefulSessionRemoteInvocationHandler.invoke(StatefulSessionRemoteInvocationHandler.java:31)
  at __Proxy1.loadComplexObject(Unknown Source)
  at serializationbug.SessionEJBClient.main(SessionEJBClient.java:30)

Nested exception is:
javax.naming.CommunicationException: Invalid UTF length [Root exception is java.io.IOException: Invalid UTF length]
  at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:311)
  at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:56)
  at com.evermind.server.rmi.NamedObjectRemoteInvocationHandler.getFreshObject(NamedObjectRemoteInvocationHandler.java:21)
    at com.evermind.server.ejb.StatefulSessionRemoteInvocationHandler.getFreshObject(StatefulSessionRemoteInvocationHandler.java:46)
  at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.getReplacementObject(RecoverableRemoteInvocationHandler.java:64)
  at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.handleRecovery(RecoverableRemoteInvocationHandler.java:41)
  at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:30)
  at com.evermind.server.ejb.StatefulSessionRemoteInvocationHandler.invoke(StatefulSessionRemoteInvocationHandler.java:31)
  at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.handleRecovery(RecoverableRemoteInvocationHandler.java:49)
... (repeating many times) ...
  at com.evermind.server.ejb.StatefulSessionRemoteInvocationHandler.invoke(StatefulSessionRemoteInvocationHandler.java:31)
  at __Proxy1.loadComplexObject(Unknown Source)
  at serializationbug.SessionEJBClient.main(SessionEJBClient.java:30)
Caused by: java.io.IOException: Invalid UTF length
  at com.evermind.io.IOUtils.readUTF(IOUtils.java:602)
  at oracle.oc4j.rmi.ClientRmiTransport.connectToServer(ClientRmiTransport.java:99)
  at oracle.oc4j.rmi.ClientSocketRmiTransport.connectToServer(ClientSocketRmiTransport.java:69)
  at com.evermind.server.rmi.RMIClientConnection.connect(RMIClientConnection.java:700)
  at com.evermind.server.rmi.RMIClientConnection.sendLookupRequest(RMIClientConnection.java:244)
  at com.evermind.server.rmi.RMIClientConnection.lookup(RMIClientConnection.java:228)
  at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:302)
... 390 more

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms