Hibernate cache failure unmarshalling remote command "java.io.InvalidObjectException: Could not find a SessionFactory" in EAP 6

Solution Verified - Updated -

Issue

  • Level 2 caching configured as replicated-cache
                <replicated-cache name="entity" mode="SYNC">
                    <transaction mode="NON_XA"/>
                    <eviction strategy="LRU" max-entries="10000"/>
                    <expiration max-idle="100000"/>
                </replicated-cache>
  • One or more entities with an @Embeddable / @EmbeddedId are already cached in a running server
@Embeddable
public class EventId implements java.io.Serializable {
        private String id;
...
        public boolean equals(Object o) {
                if (o instanceof EventId) {
                        return id.equals(EventId.class.cast(o).id);
                } else {
                        return false;
                }
        }

        public int hashCode() {
                return id.hashCode();
        }
}

@Entity
public class Event {
        @EmbeddedId
        private EventId id;
...
}
  • When a new server is started and joins the cluster, "Problems unmarshalling remote command from byte buffer: java.io.InvalidObjectException: Could not find a SessionFactory" is reported while replicating entities with @Embeddable ids
... WARN  [org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher] ... Problems unmarshalling remote command from byte buffer: java.io.InvalidObjectException: Could not find a SessionFactory [uuid=7f3079b0-fd41-4407-b888-7559d1ad96ff,name=jboss.eap-1.0-SNAPSHOT.jar#jboss-eap-hibernate]
        at org.hibernate.internal.SessionFactoryImpl.locateSessionFactoryOnDeserialization(SessionFactoryImpl.java:1809) [hibernate-core-4.2.14.SP1-redhat-1.jar:4.2.14.SP1-redhat-1]
        at org.hibernate.internal.SessionFactoryImpl.readResolve(SessionFactoryImpl.java:1789) [hibernate-core-4.2.14.SP1-redhat-1.jar:4.2.14.SP1-redhat-1]
        ...
        at org.jboss.marshalling.reflect.SerializableClass.callReadResolve(SerializableClass.java:413)
        ...
        at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1712)
        at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1628)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1269)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
        at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41)
        at org.infinispan.container.entries.TransientCacheEntry$Externalizer.readObject(TransientCacheEntry.java:177)
        at org.infinispan.container.entries.TransientCacheEntry$Externalizer.readObject(TransientCacheEntry.java:166)
        at org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.readObject(ExternalizerTable.java:406)
        at org.infinispan.marshall.jboss.ExternalizerTable.readObject(ExternalizerTable.java:226)
        at org.infinispan.marshall.jboss.JBossMarshaller$ExternalizerTableProxy.readObject(JBossMarshaller.java:167)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:351)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
        at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41)
        at org.infinispan.marshall.exts.ArrayListExternalizer.readObject(ArrayListExternalizer.java:57)
        at org.infinispan.marshall.exts.ArrayListExternalizer.readObject(ArrayListExternalizer.java:45)
        at org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.readObject(ExternalizerTable.java:406)
        at org.infinispan.marshall.jboss.ExternalizerTable.readObject(ExternalizerTable.java:226)
        at org.infinispan.marshall.jboss.JBossMarshaller$ExternalizerTableProxy.readObject(JBossMarshaller.java:167)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:351)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
        at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41)
        at org.infinispan.statetransfer.StateChunk$Externalizer.readObject(StateChunk.java:111)
        at org.infinispan.statetransfer.StateChunk$Externalizer.readObject(StateChunk.java:88)
        at org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.readObject(ExternalizerTable.java:406)
        at org.infinispan.marshall.jboss.ExternalizerTable.readObject(ExternalizerTable.java:226)
        at org.infinispan.marshall.jboss.JBossMarshaller$ExternalizerTableProxy.readObject(JBossMarshaller.java:167)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:351)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
        at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41)
        at org.infinispan.marshall.exts.ArrayListExternalizer.readObject(ArrayListExternalizer.java:57)
        at org.infinispan.marshall.exts.ArrayListExternalizer.readObject(ArrayListExternalizer.java:45)
        at org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.readObject(ExternalizerTable.java:406)
        at org.infinispan.marshall.jboss.ExternalizerTable.readObject(ExternalizerTable.java:226)
        at org.infinispan.marshall.jboss.JBossMarshaller$ExternalizerTableProxy.readObject(JBossMarshaller.java:167)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:351)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
        at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41)
        at org.infinispan.marshall.exts.ReplicableCommandExternalizer.readParameters(ReplicableCommandExternalizer.java:130)
        at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.readObject(CacheRpcCommandExternalizer.java:158)
        at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.readObject(CacheRpcCommandExternalizer.java:73)
        at org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.readObject(ExternalizerTable.java:406)
        at org.infinispan.marshall.jboss.ExternalizerTable.readObject(ExternalizerTable.java:226)
        at org.infinispan.marshall.jboss.JBossMarshaller$ExternalizerTableProxy.readObject(JBossMarshaller.java:167)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:351)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
        at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41)
        at org.infinispan.marshall.jboss.AbstractJBossMarshaller.objectFromObjectStream(AbstractJBossMarshaller.java:163)
        at org.infinispan.marshall.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:121)
        at org.infinispan.marshall.AbstractDelegatingMarshaller.objectFromByteBuffer(AbstractDelegatingMarshaller.java:104)
        at org.infinispan.remoting.transport.jgroups.MarshallerAdapter.objectFromBuffer(MarshallerAdapter.java:50)
        at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.handle(CommandAwareRpcDispatcher.java:215)
        at org.jgroups.blocks.RequestCorrelator.handleRequest(RequestCorrelator.java:484)
        at org.jgroups.blocks.RequestCorrelator.receiveMessage(RequestCorrelator.java:391)
        at org.jgroups.blocks.RequestCorrelator.receive(RequestCorrelator.java:249)
        at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.up(MessageDispatcher.java:600)
        at org.jgroups.blocks.mux.MuxUpHandler.up(MuxUpHandler.java:130)
        at org.jgroups.JChannel.up(JChannel.java:707)
        at org.jgroups.stack.ProtocolStack.up(ProtocolStack.java:1025)
        at org.jgroups.protocols.RSVP.up(RSVP.java:172)
        at org.jgroups.protocols.FRAG2.up(FRAG2.java:181)
        at org.jgroups.protocols.FlowControl.up(FlowControl.java:418)
        at org.jgroups.protocols.FlowControl.up(FlowControl.java:400)
        at org.jgroups.protocols.pbcast.GMS.up(GMS.java:896)
        at org.jgroups.protocols.pbcast.STABLE.up(STABLE.java:245)
        at org.jgroups.protocols.UNICAST2.handleDataReceived(UNICAST2.java:766)
        at org.jgroups.protocols.UNICAST2.up(UNICAST2.java:420)
        at org.jgroups.protocols.pbcast.NAKACK.up(NAKACK.java:645)
        at org.jgroups.protocols.VERIFY_SUSPECT.up(VERIFY_SUSPECT.java:147)
        at org.jgroups.protocols.FD.up(FD.java:253)
        at org.jgroups.protocols.FD_SOCK.up(FD_SOCK.java:288)
        at org.jgroups.protocols.MERGE3.up(MERGE3.java:290)
        at org.jgroups.protocols.Discovery.up(Discovery.java:359)
        at org.jgroups.protocols.TP$ProtocolAdapter.up(TP.java:2607)
        at org.jgroups.protocols.TP.passMessageUp(TP.java:1260)
        at org.jgroups.protocols.TP$IncomingPacket.handleMyMessage(TP.java:1822)
        at org.jgroups.protocols.TP$IncomingPacket.run(TP.java:1795)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_45]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_45]
        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_45]
Caused by: an exception which occurred:
        in object of type org.hibernate.internal.SessionFactoryImpl
                -> classloader hierarchy:
                -> type classloader = ModuleClassLoader for Module "org.hibernate:main" from local module loader @2c19e15c (finder: local module finder @571a75a2 (roots: /opt/jboss-eap-6.3.0/modules,/opt/jboss-eap-6.3.0/modules/system/layers/base))
                -> parent classloader = sun.misc.Launcher$AppClassLoader@425224ee
                ->...file:/opt/jboss-eap-6.3.0/jboss-modules.jar
                -> parent classloader = sun.misc.Launcher$ExtClassLoader@1ef6a746
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/sunpkcs11.jar
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/dnsns.jar
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/sunjce_provider.jar
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/localedata.jar
        in field factory
        in object of type org.hibernate.type.TypeFactory$TypeScopeImpl
                -> classloader hierarchy:
                -> type classloader = ModuleClassLoader for Module "org.hibernate:main" from local module loader @2c19e15c (finder: local module finder @571a75a2 (roots: /opt/jboss-eap-6.3.0/modules,/opt/jboss-eap-6.3.0/modules/system/layers/base))
                -> parent classloader = sun.misc.Launcher$AppClassLoader@425224ee
                ->...file:/opt/jboss-eap-6.3.0/jboss-modules.jar
                -> parent classloader = sun.misc.Launcher$ExtClassLoader@1ef6a746
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/sunpkcs11.jar
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/dnsns.jar
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/sunjce_provider.jar
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/localedata.jar
        in field typeScope
        in object of type org.hibernate.type.ComponentType
                -> classloader hierarchy:
                -> type classloader = ModuleClassLoader for Module "org.hibernate:main" from local module loader @2c19e15c (finder: local module finder @571a75a2 (roots: /opt/jboss-eap-6.3.0/modules,/opt/jboss-eap-6.3.0/modules/system/layers/base))
                -> parent classloader = sun.misc.Launcher$AppClassLoader@425224ee
                ->...file:/opt/jboss-eap-6.3.0/jboss-modules.jar
                -> parent classloader = sun.misc.Launcher$ExtClassLoader@1ef6a746
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/sunpkcs11.jar
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/dnsns.jar
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/sunjce_provider.jar
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/localedata.jar
        in field type
        in object of type org.hibernate.cache.spi.CacheKey
                -> classloader hierarchy:
                -> type classloader = ModuleClassLoader for Module "org.hibernate:main" from local module loader @2c19e15c (finder: local module finder @571a75a2 (roots: /opt/jboss-eap-6.3.0/modules,/opt/jboss-eap-6.3.0/modules/system/layers/base))
                -> parent classloader = sun.misc.Launcher$AppClassLoader@425224ee
                ->...file:/opt/jboss-eap-6.3.0/jboss-modules.jar
                -> parent classloader = sun.misc.Launcher$ExtClassLoader@1ef6a746
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/sunpkcs11.jar
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/dnsns.jar
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/sunjce_provider.jar
                ->...file:/opt/jdk1.6.0_45/jre/lib/ext/localedata.jar

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 6
  • Hibernate 4
  • Infinispan

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
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.