|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
- 发信人: rhythin (多米诺骨牌), 信区: Java
- 标 题: HLP!ClassLoader!
- 发信站: BBS 水木清华站 (Mon Apr 5 14:57:31 1999)
- 同一个class用不同的ClassLoader调入, 系统会认为是相同的class吗?
- 发信人: Liyuany (缘分), 信区: Java
- 标 题: Re: HLP!ClassLoader!
- 发信站: BBS 水木清华站 (Mon Apr 5 17:01:13 1999) WWW-POST
- 我现在正在为这个问题头疼,系统绝对不会认为是同一个class.
- 【 在 rhythin (多米诺骨牌) 的大作中提到: 】
- : 同一个class用不同的ClassLoader调入, 系统会认为是相同的class吗?
- 发信人: rhythin (多米诺骨牌), 信区: Java
- 标 题: Re: HLP!ClassLoader!
- 发信站: BBS 水木清华站 (Tue Apr 6 12:18:09 1999)
- 是啊, 我用一个小程序证明了这一点.
- 现在的问题是, 我要把一个用ClassLoader调入的对象export到RMI的Registry里去,
- 可是Client一lookup()就出了个ServerRuntimeException--ClassCastException.
- 这回可是彻底完了, 所有的工作都白做了.
- 【 在 Liyuany (缘分) 的大作中提到: 】
- :
- : 我现在正在为这个问题头疼,系统绝对不会认为是同一个class.
- :
- : 【 在 rhythin (多米诺骨牌) 的大作中提到: 】
- 发信人: Liyuany (缘分), 信区: Java
- 标 题: Re: HLP!ClassLoader!
- 发信站: BBS 水木清华站 (Wed Apr 7 12:48:06 1999) WWW-POST
- 看来真有缘分一说,hehe。我头疼的就是这个问题。我用自己的ClassLoader
- 装入jar文件。然后,利用rmi机制调用远程方法,就会有例外ClassNotFound。好象
- rmi用的装载器是系统的,它不认识我的ClassLoader装入的类。
- 不知道你做的是什么项目?能交流一下吗?如果愿意请给我发Email
- [email]lqw@csc.neu.edu.cn[/email]
- 【 在 rhythin (多米诺骨牌) 的大作中提到: 】
- : 是啊, 我用一个小程序证明了这一点.
- : 现在的问题是, 我要把一个用ClassLoader调入的对象export到RMI的Registry里去,
- : 可是Client一lookup()就出了个ServerRuntimeException--ClassCastException.
- : 这回可是彻底完了, 所有的工作都白做了.
- 发信人: rhythin (多米诺骨牌), 信区: Java
- 标 题: Re: HLP!ClassLoader!
- 发信站: BBS 水木清华站 (Wed Apr 7 13:15:41 1999)
- 我给你发的信被退回来了, 说没这用户!
- Hi, I have partly solved the problem. If on the client side, we use
- Object instead of the remote interface to get the stub, no exception
- will be thrown.
- i.e.
- Object obj = Naming.lookup("//foo/bar");
- not RemoteBar obj = (RemoteBar) naming.lookup(...)
- That's why I asked the second question. Though you know the remote
- interface of the remote object, you cannot use it to cast the stub you
- got, because the class loaded by system will be treated as a different
- class. So maybe we have to use reflection to solve the problem, too bad.
- 【 在 Liyuany (缘分) 的大作中提到: 】
- :
- : 看来真有缘分一说,hehe。我头疼的就是这个问题。我用自己的ClassLoader
- : 装入jar文件。然后,利用rmi机制调用远程方法,就会有例外ClassNotFound。好象
- : rmi用的装载器是系统的,它不认识我的ClassLoader装入的类。
- : 不知道你做的是什么项目?能交流一下吗?如果愿意请给我发Email
- : [email]lqw@csc.neu.edu.cn[/email]
- :
- : 【 在 rhythin (多米诺骨牌) 的大作中提到: 】
- 发信人: rhythin (多米诺骨牌), 信区: Java
- 标 题: Re: HLP!ClassLoader!
- 发信站: BBS 水木清华站 (Tue Apr 13 14:24:02 1999)
- What kinda system are you using? I just found that under solaris, the java
- jdk1.1.3 has some problem to deal with it, but if you use jdk1.1.6, it will be
- much better.
- 【 在 Liyuany (缘分) 的大作中提到: 】
- :
- : 看来真有缘分一说,hehe。我头疼的就是这个问题。我用自己的ClassLoader
- : 装入jar文件。然后,利用rmi机制调用远程方法,就会有例外ClassNotFound。好象
- : rmi用的装载器是系统的,它不认识我的ClassLoader装入的类。
- : 不知道你做的是什么项目?能交流一下吗?如果愿意请给我发Email
- : [email]lqw@csc.neu.edu.cn[/email]
- :
- : 【 在 rhythin (多米诺骨牌) 的大作中提到: 】
复制代码 |
|