It sounds very strange. Firstly, if the code has been running for a while, as you say, the file should be there. Secondly, the JVM rarely unloads a class from memory after using it. Some JVMs will do this in hard memory or as part of the GC, but they usually stick with it as an optimization.
My only assumption: you are using the JVM in a situation where ClassLoaders are changing. If you use Netbeans (especially), but I think it is also an eclipse, then if you partially recompile the code, then the class loaders may not match. Does it work in an IDE?
An alternative is to change the ClassLoader. If you are republishing to a running web server or application server, then the old class will not have the appropriate class loader for the new instance. ClassLoader may not be able to find the old version, even if there is a file. Are you resubmitting to the app / web server?
Finally, I suggest that this is possible with serialization. If the Serializable class and serialVersionUID do not match, I assume this could happen. Do you serialize objects here?
Nick fortescue
source share