rpc 报错 ClassNotFoundException

运行环境 | eclipse 12 | jdk1.8

rpc发送Request对象报错 java.lang.ClassNotFoundException

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Exception in thread "main" java.lang.ClassNotFoundException: rpc_client.pojo.Request
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 rpc_server.admin.Server.main(Server.java:20)

解决方法:

request 和 user 路径要一致(两文件路径必须一致)


import rpc_client.pojo.Request;
import rpc_client.pojo.User;

改为

import pojo.Request;
import pojo.User;

本文结束感谢您的阅读,本文原创–支持原创
顺便打点赏吧~ 有问题请联系我--strivedeer@163.com