`

对象逆序列化报错:java.lang.ClassNotFoundException

    博客分类:
  • Java
 
阅读更多

简单的想从保存的对象中重新解析出对象,用了逆序列化,可是报错:

java.lang.ClassNotFoundException: xxxxxxxxxxxx
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:622)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1593)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1514)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at xxxxxxxxxxxxxxxxx(TestMetadata.java:103)

 

提示类找不到,但实际上类文件是确确实实存在的,那就上网搜,果然找到答案。

可以参考文章: http://www.javapractices.com/topic/TopicAction.do?Id=45

最基本的两点:

1) 需要同样的包名

2) 同样的序列化ID

 

转载自:https://blog.csdn.net/wwwgeyang777/article/details/24293589

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics