I've OSGi'ed a body of code that reads a model from an ObjectInputStream. I didn't adjust the TCCL, and I didn't make a custom object input stream that respects the TCCL, as per http://tech-tauk.blogspot.com/2010/05/thread-context-classlaoder-in.html. Yet, it works.
Except, strangely, when it does not. Under circumstances I am struggling to isolate, it fails to read the object. This is not helped by the fact that OIS, in this case, does not set the exception cause to reveal what actually went wrong. The exception is not a class-not-found at all. Has anyone else seen anything like this? java.lang.IllegalStateException: unread block data at java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode(ObjectInputStream.java:2431)[:1.8.0_60] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1383)[:1.8.0_60] at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2000)[:1.8.0_60]