class invalid for deserialization - Deserializes from file working but not blob?
<p>The problem lies when trying to deserialize an instance of the class itemSet returned in a resultSet after querying my database. The blobfile seems to be fine itself and the data can be saved to a file then correctly read using a filereader (see below) as such I'm inclined to believe the issue lies somewhere in my implementation? The program runs on tomcat using the netbeans 8.01 ide.</p>

<p>My project git link: <a href="https://github.com/feltax/gw2apiMark2" rel="nofollow">https://github.com/feltax/gw2apiMark2</a></p>

<p>My project is using a modified wrapper for a few classes: <a href="https://github.com/feltax/gw2apiModified" rel="nofollow">https://github.com/feltax/gw2apiModified</a></p>

<p>The exact error: </p>

<pre><code>type Exception report message me.nithanim.gw2api.v2.api.items.ItemInfo; 
class invalid for deserialization
description The server encountered an internal error that prevented it from fulfilling this request.
exception java.io.InvalidClassException: me.nithanim.gw2api.v2.api.items.ItemInfo; class invalid for deserialization
 java.io.ObjectStreamClass$ExceptionInfo.newInvalidClassException(ObjectStreamClass.java:150)
java.io.ObjectStreamClass.checkDeserialize(ObjectStreamClass.java:790)
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1775)
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2000)
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1924)
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
Persistance.DbConnect.getItemSets(DbConnect.java:134)
Servlets.TestServlet.doPost(TestServlet.java:84)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)

note the full stack trace of the root cause is available in the Apache Tomcat/8.0.27 logs.
</code></pre>

<p><strong>Relevent code:</strong> (sorry about the links, this is the first time I've asked for help so I had to butcher them)</p>

<p>DB Connection code: issue occurs on line 134
<a href="http://github.com/feltax/gw2apiMark2/blob/master/src/main/java/Persistance/DbConnect.java" rel="nofollow">github.com/feltax/gw2apiMark2/blob/master/src/main/java/Persistance/DbConnect.java</a></p>

<p>ItemInfo class:
<a href="http://github.com/feltax/gw2apiModified/blob/master/src/main/java/me/nithanim/gw2api/v2/api/items/ItemInfo.java" rel="nofollow">github.com/feltax/gw2apiModified/blob/master/src/main/java/me/nithanim/gw2api/v2/api/items/ItemInfo.java</a></p>

<p>ItemSet Class:
<a href="http://github.com/feltax/gw2apiMark2/blob/master/src/main/java/ItemSets/itemSet.java" rel="nofollow">github.com/feltax/gw2apiMark2/blob/master/src/main/java/ItemSets/itemSet.java</a></p>

<p>my Database:
<a href="http://imgur.com/zfPLSsq" rel="nofollow">imgur.com/zfPLSsq</a></p>

<p><strong>Things I have tried:</strong></p>

<p>Serial UID Declaration, ensuring all classes implement serializable and have a generated serialUid (also without serialUID).</p>

<p>Remaking the database any time I change a class and thus reseralising all objects stored within.</p>

<p>Ensuring the blob file is correct by saving it to file in mysqlworkbench and then reading in the object with the code below. The itemSet read in fine and the files were identical.
<a href="http://github.com/feltax/gw2apiMark2/blob/master/src/main/java/Persistance/apiDump.java" rel="nofollow">github.com/feltax/gw2apiMark2/blob/master/src/main/java/Persistance/apiDump.java</a> </p>

<p>Implementing De-compressible input stream: <a href="http://github.com/feltax/gw2apiMark2/blob/master/src/main/java/Persistance/DecompressibleInputStream.java" rel="nofollow">github.com/feltax/gw2apiMark2/blob/master/src/main/java/Persistance/DecompressibleInputStream.java</a></p>

<p>Trying to serialize and deserialize byte array, input streams and using get object</p>

<p>Finally I asked for help on reddit but I didn't really get far. here: <a href="http://www.reddit.com/r/learnprogramming/comments/4i68fj/java_class_invalid_for_de_serialization_error/" rel="nofollow">www.reddit.com/r/learnprogramming/comments/4i68fj/java_class_invalid_for_de_serialization_error/</a> </p>

<p><strong>New things I have now tried:</strong></p>

<p>Adding a simple no-args constructor to basicItem and rebuilding the code/database, still getting the same error unfortunately. </p>

<pre><code>  public BasicItem() {
  }
</code></pre>

<p>-- Suggestion thanks to EJP</p>

<p>As a thought, could this be something to do with a single item appearing in multiple itemSets? Does java have a problem deseralising an object that it's already deseralised before?</p>