[英]Can classes used in .ser java file be edited after .ser file creation?
I am trying to load a .ser file of a class I made a while back. 我正在尝试加载前一段时间制作的类的.ser文件。
But I'm getting ClassNotFoundException
. 但是我正在收到
ClassNotFoundException
。
I'm wondering, is it because I made changes to the class used in those files? 我想知道,是因为我对这些文件中使用的类进行了更改吗? Because the class name is the same, the only changes are some new methods.
因为类名相同,所以唯一的更改是一些新方法。
If this is the case, is there a way I load .ser files that had their classes changed after creation? 如果是这种情况,是否可以加载在创建后更改了类的.ser文件?
java.lang.ClassNotFoundException: ebay.ItemEditObject
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at java.io.ObjectInputStream.resolveClass(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at ebay.EbayMaster.getObjFromFile(EbayMaster.java:750)
at ebay.EbayMaster.createItemsForUpload(EbayMaster.java:340)
at ebay.EbayMaster.ebayRunner(EbayMaster.java:129)
at ebay.EbayMaster.main(EbayMaster.java:92)
I'm wondering, is it because I made changes to the class used in those files?
我想知道,是因为我对这些文件中使用的类进行了更改吗?
No. 没有。
Because the class name is the same, the only changes are some new methods.
因为类名相同,所以唯一的更改是一些新方法。
That could cause an InvalidClassException
. 这可能会导致
InvalidClassException
。 Not a ClassNotFoundException
. 不是
ClassNotFoundException
。
But you aren't getting either of these. 但是您没有得到任何一个。 You're getting
FileNotFoundException.
您正在获取
FileNotFoundException.
The file wasn't found. 找不到文件。 Look again.
再看一遍。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.