Session Replication Failing With The Exception java.io.NotSerializableException

Solution Verified - Updated -

Issue

  • The following error appears in the logs. What is the implication for session replication and how can it be resolved?
        ERROR [JBossCacheService] externalizeSession(): exception occurred
        externalizing session SessionBasedClusteredSession[id:
        nFTh1yoC83B5EHj4+8qWDQ**.node1 lastAccessedTime: 1268256303847 version:
        4 lastOutdated: 0]
        java.io.NotSerializableException: <name of class>
  • I discovered that even though our own code only puts Serializable objects in the session, Spring puts non-serializable objects in the session when we use the Spring option sessionForm=true. That obviously causes problems when the cluster tries to synchronize the session between the nodes.
  • When working in our application (web part/ejb part), we are getting the following exception:
        ERROR [org.jboss.cache.marshall.CacheMarshaller300] (http-127.0.0.1-8080-2) Error while marshalling object: ReplicateCommand{cmds=PutDataMapCommand{fqn=/JSESSION/sg_localhost/wumZ8GxmbL5ojIJkIS9eBg__, dataVersion=null, data={0=1, 1=1322745674120, 2=org.jboss.web.tomcat.service.session.distributedcache.spi.DistributableSessionMetadata@7de3f9f1, 3=org.jboss.ha.framework.server.SimpleCachableMarshalledValue{raw=java.util.HashMap@1284729517serialized=false}}, globalTransaction=null, erase=false}}
        java.io.NotSerializableException: java.lang.Object
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
  • Which object is not serializable? Is there an easy way to identify the objects?
  • I have setup 2 JBoss EAP 5.1.0 into cluster then in our web.xml added <distributable/> tag and in logs files I see the below error :
 ERROR [CommandAwareRpcDispatcher] java.io.NotSerializableException: java.util.concurrent.FutureTask
  • In EAP 6, serialization fails with the following ERROR:
ERROR [org.infinispan.transaction.TransactionCoordinator] (http-/192.168.82.19:8332-8) ISPN000097: Error while processing a prepare in a single-phase transaction: org.infinispan.CacheException: java.lang.RuntimeException: Failure to marshal argument(s)
    at org.infinispan.util.Util.rewrapAsCacheException(Util.java:542)
    at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommands(CommandAwareRpcDispatcher.java:153)
    at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.broadcastRemoteCommands(CommandAwareRpcDispatcher.java:197)
    at org.infinispan.remoting.transport.jgroups.JGroupsTransport.invokeRemotely(JGroupsTransport.java:498)
    at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:169)
    at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:190)
    at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:247)
...
Caused by: java.lang.RuntimeException: Failure to marshal argument(s)
    at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.marshallCall(CommandAwareRpcDispatcher.java:281)
    at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.processCalls(CommandAwareRpcDispatcher.java:332)
    at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommands(CommandAwareRpcDispatcher.java:146)
    ... 80 more
Caused by: org.infinispan.marshall.NotSerializableException: this.is.my.object
Caused by: an exception which occurred:
    in field target
    in field targetSource
    in field advised
    in field ccSolicitudesService
    in object java.util.HashMap@55f09b27
    in object org.jboss.as.clustering.SimpleMarshalledValue@55f09b27
    in object org.infinispan.atomic.PutOperation@c94cb0d4
    in object java.util.LinkedList@7d469a95
    in object org.infinispan.atomic.AtomicHashMapDelta@1f4646d7
    in object org.infinispan.commands.write.PutKeyValueCommand@4739152a
    in object org.infinispan.commands.tx.PrepareCommand@92d8fdd3
ERROR [org.infinispan.interceptors.InvocationContextInterceptor] (ajp-/10.38.73.150:8009-2) ISPN000136: Execution error: org.infinispan.CacheException: java.lang.RuntimeException: Failure to marshal argument(s)
    at org.infinispan.util.Util.rewrapAsCacheException(Util.java:542)
    at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommand(CommandAwareRpcDispatcher.java:186)
    at org.infinispan.remoting.transport.jgroups.JGroupsTransport.invokeRemotely(JGroupsTransport.java:515)
    at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:173)
    at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:194)
    at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:251)
    at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:238)
    at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:233)
...
Caused by: java.lang.RuntimeException: Failure to marshal argument(s)
    at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.marshallCall(CommandAwareRpcDispatcher.java:281)
    at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.processSingleCall(CommandAwareRpcDispatcher.java:300)
    at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommand(CommandAwareRpcDispatcher.java:179)
    ... 80 more
Caused by: org.infinispan.marshall.NotSerializableException: this.is.my.object
Caused by: an exception which occurred:
    in field convFactors
    in field orderItemList
    in field materialBean
    in object java.util.HashMap@3ceddee4
    in object org.jboss.as.clustering.SimpleMarshalledValue@3ceddee4
    in object org.infinispan.atomic.PutOperation@20530a83
    in object java.util.LinkedList@f2784c57
    in object org.infinispan.atomic.AtomicHashMapDelta@13452861
    in object org.infinispan.commands.write.PutKeyValueCommand@e593a539
    in object org.infinispan.commands.tx.PrepareCommand@7acfe1a3
  • Errors ISPN000136, ISPN000097, ISPN000111

  • We are running three nodes. It would be possible to use farming instead of clustering them. Would this solve the NotSerializableException problem? Are there any parameters for Infinispan that would solve the problem? Is it possible to deactivate Infinispan?

2019-05-28 08:21:37,807 ERROR [org.infinispan.remoting.rpc.RpcManagerImpl] (default task-2) ISPN000073: Unexpected error while replicating: org.infinispan.commons.marshall.NotSerializableException: org.apache.commons.configuration.XMLConfiguration$XMLFileConfigurationDelegate
Caused by: an exception which occurred:
        in field org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.delegate
        in object org.apache.commons.configuration.XMLConfiguration@a9d253e
        in field be.sofico.web.frmwrk.mgbean.settings.UserPreferences.xmlConfiguration
        in object be.sofico.web.frmwrk.mgbean.settings.UserPreferences@7bad3ed
        in field org.jboss.weld.context.SerializableContextualInstanceImpl.instance
        in object org.jboss.weld.context.SerializableContextualInstanceImpl@374c2140
        in object org.jboss.weld.context.SerializableContextualInstanceImpl@374c2140
        in object java.util.HashMap@58f48a74
        in object org.wildfly.clustering.marshalling.jboss.SimpleMarshalledValue@58f48a74
        in object org.infinispan.commands.write.PutKeyValueCommand@841a26d6
        in object org.infinispan.commands.tx.PrepareCommand@2fd31e47

Environment

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

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In