这是我的设置:
我的服务器等待IPlugin-Objects
ObjectInputStream
。传入的IPlugin-Ob
ject属于未知类,因此首先,类文件由OIS的classloader
传输和加载。然后,IPlugin本身由客户端发送。 IPlugin的演员似乎不是一个问题(在OIS中使用我自己的类加载器时)。但是IPlugin使用了jama,现在我收到了对象时得到了NoClassDefFoundException
。对我来说奇怪的是,在服务器classpath
中包含Jama-library。我也试过写一个虚线,所以库真的会被导入(编译器不会忽略)。
有人可以帮助我吗?这真让我烦恼......
答案 0 :(得分:0)
好的,我知道了:
问题是,我的个人URIClassLoader获得了所有URI,除了当前的类加载器。现在构造函数如下所示:
URLClassLoader loader = new URLClassLoader(new URL[]{pluginFolder.toURI().toURL()},
this.getClass().getClassLoader());