rmi network traffic
Darryl Mocek
darryl.mocek at oracle.com
Fri Aug 24 00:15:43 UTC 2012
Hi fuyou001,
if you're using RMI in a J2SE project and it is OK, but it isn't
when you use the web project, then I suggest you look at the Jetty/Resin
implementation as it may be the culprit. Specifically, I'd look at the
ClassLoader in use. See this URL
(http://java.sun.com/javase/6/docs/api/java/rmi/server/RMIClassLoader.html#getDefaultProviderInstance()).
If the ClassLoader is a URLClassLoader, then the loader's |getURLs|
method may be called, which may return a list of URls of the
application's class path. It may also be that the value of the
|java.rmi.server.codebase property is being returned, so you should look
at that as well. The URL gives more details on the issue.
||See below for information from the bug report.
Darryl
|
RMI's marshalling format annotates serialized class descriptors with a
"codebase URL path" in case the class needs to be dynamically loaded
by the receiving party. ... The value used for this annotation is
controlled by the RMIClassLoader provider's getClassAnotation method:
http://java.sun.com/javase/6/docs/api/java/rmi/server/RMIClassLoader.html#getClassAnnotation(java.lang.Class)
which the default provider implements as described here:
http://java.sun.com/javase/6/docs/api/java/rmi/server/RMIClassLoader.html#getDefaultProviderInstance()
*Basically, if the class's defining loader is the system class loader
or one of its ancestors, or if it is not a URLClassLoader, then the
value of the "java.rmi.server.codebase" system property is used;
otherwise, a string form of the result of invoking
URLClassLoader.getURLs on the loader is used.*
In this case, I gather that the ClassLoader is not configured to
be considered the system class loader, but it is a URLClassLoader
whose getURLs method returns the URLs of the application's class path,
which in this case is quite lengthy.
On 08/21/2012 07:23 PM, fuyou wrote:
> Hi all
>
> I deploy a RMI Service ,write a RMI Client(J2SE project) to access it
> and is ok .but the some code in web project,I use wireshark to find that
> every RMI request sent from our client to our server containing the list of
> all jars in the classpath for the application, My problem is similar to
> bugs.sun.com <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6664389>
>
> java -version
> java version "1.6.0_33"
> Java(TM) SE Runtime Environment (build 1.6.0_33-b03)
> Java HotSpot(TM) Server VM (build 20.8-b03, mixed mode)
>
> This issues may be caused by Servlet Container(etc Jetty/Resin)
> classloader
> How to slove it ?
>
> Sorry for disturbing again.
> Thanks a lot!
>
More information about the core-libs-dev
mailing list