7 Replies Latest reply on May 19, 2015 12:08 PM by Fei Chen

    Get ClassCastException [MarshalledValue cannot be cast] when iterating the cache

    Fei Chen Newbie

      I have a cache Cache<com.test.Channel, Long> with the following configuration:

      • replicated cache
      • mode=SYNC
      • eviction strategy="LRU"
      • transactional = true
      • storeAsBinary = true


      com.test.Channel is Serializable and contains 2 members:   private String resource;  private String name;


      The ClassCastException happens when trying to iterator the cache:

      06:54:47,057 ERROR [org.jboss.as.ejb3.invocation] (http-localhost/ JBAS014134: EJB Invocation failed on component PublishManagerLocalBean for method public abstract java.util.Set com.test.PublishManager.getChannels(): javax.ejb.EJBException: java.lang.ClassCastException: org.infinispan.marshall.core.MarshalledValue cannot be cast to com.test.Channel

      I see the problem is:  I store only one entry into the cache. But afterwards when iterating the cache, 2 entries are returned.  One entry is with type Channel which looks correct,  but there is another entry with type MarshalledValue.


      Anybody know why is the MarshalledValue instance stored in the cache?  Thanks in advance.