[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
java.io.InvalidClassException on intrface during deserialization  XML
Forum Index -> Terracotta Platform
Author Message
pomelko

journeyman

Joined: 03/15/2012 12:17:17
Messages: 13
Offline

Hi,

We are using open-source Terracotta Server Array (3.5.4) as Distributed Cache. Webapps with ehcache are terracotta clients (deployed on Tomcats 6.0.20). In ehcache.xml we have defined cache region as follow:

Code:
 <cache name="cache.region" maxElementsInMemory="1" maxElementsOnDisk="30000" timeToLiveSeconds="600">
 	<terracotta>
 		<nonstop timeoutMillis="10000">
 			<timeoutBehavior type="noop"/>
 		</nonstop>
 	</terracotta>
 </cache>
 


We are puting Product objects to that region. Here is a Product class definition:

Code:
 public class Product implements IProduct {
 
 	private static final long serialVersionUID = 8439118773143689889L;
 
 	private long id;
 	
 	@Override
 	public long getId() {
 		return id;
 	}
 
 	@Override
 	public void setId(long id) {
 		this.id = id;		
 	}
 }
 
 import java.io.Serializable;
 
 public interface IProduct extends Serializable {
 
 	long getId();
 
 	void setId(long id);
 }
 


When we do some changes in class Product, and then deploying it on Tomcat, an exception occure when we are trying get object from cache:

Code:
 Aug 22 00:02:03 net.sf.ehcache.CacheException: java.lang.AssertionError: java.io.InvalidClassException: IProduct; local class incompatible: stream classdesc serialVersionUID = -57040766891247554, local class serialVersionUID = -3776498516536327490
 Aug 22 00:02:03 at net.sf.ehcache.constructs.nonstop.NonstopExecutorServiceImpl.execute(NonstopExecutorServiceImpl.java:96)
 Aug 22 00:02:03 at net.sf.ehcache.constructs.nonstop.store.ExecutorServiceStore.executeWithExecutor(ExecutorServiceStore.java:158)
 Aug 22 00:02:03 at net.sf.ehcache.constructs.nonstop.store.ExecutorServiceStore.executeWithExecutor(ExecutorServiceStore.java:127)
 Aug 22 00:02:03 at net.sf.ehcache.constructs.nonstop.store.ExecutorServiceStore.containsKeyInMemory(ExecutorServiceStore.java:720)
 Aug 22 00:02:03 at net.sf.ehcache.constructs.nonstop.store.NonstopStoreImpl.containsKeyInMemory(NonstopStoreImpl.java:287)
 Aug 22 00:02:03 at net.sf.ehcache.Cache.searchInStoreWithStats(Cache.java:1881)
 Aug 22 00:02:03 at net.sf.ehcache.Cache.get(Cache.java:1546)
 


Everything is back to normal after cache cleaning - cache.removeAll().

And now I have few questions:

1) Why there is an interface name (IProduct) in exception message instead of implementation (Product)?
2) Why both serialVersionUID from an exception, doesn't correspond with one defined in Product class?
3) Is there any automatic way to invalidate object in Terracotta after implementation changes, to prevent described exception?

Thanks in advance,
Paweł
 
Forum Index -> Terracotta Platform
Go to:   
Powered by JForum 2.1.7 © JForum Team