4 Replies Latest reply on Oct 13, 2009 4:59 PM by drcallaway

    Serialization problem using JDBC cache loader and MySQL

    drcallaway

      I am running into a problem when deserializing objects stored in the JBoss Cache via the JDBC cache loader. I can start the cache, load objects into it, and read objects from it without a problem. The objects that I have stored in the cache specifically set the serialVersionUID variable to 1. This all works fine until I shutdown and restart the cache. At this point, I get this error when attempting to access a node:

      [JDBCCacheLoader] Failed to load node for fqn /mynode java.lang.Exception:
      Unable to load to deserialize result:
      Caused by: java.io.InvalidClassException: com.company.generated.MyNode; local class incompatible:
      stream classdesc serialVersionUID = 1, local class serialVersionUID = -7258818124315218931


      According to this error, it looks like the version of the class stored in the database has a UID of 1 (which is correct). However, it then indicates that the local class has a UID of -7258818124315218931. Why is JBoss generating a UID when the local class already specifies a serialVersionUID of 1? After all, it was the exact same version of this local class that was stored in the cache to begin with.

      Any suggestions are appreciated.

      Thanks!

      Dustin