Interesting problem. You're right that the java.server.rmi.codebase
property is ignored in Tomcat. The property is only used by the
RMIClassloader when a class's loader has "no obvious codebase property". If
the classloader extends from URLClassLoader, as Tomcat's WebAppClassloader
does, then the value of getURLs() is used for the annotation. In the case
of Tomcat, that annotation will include everything in WEB-INF/lib,
common/lib, etc. For RMI purposes, it's entirely useless anyway, since it
doesn't contain a url to your publicly accessible classes for RMI download.
There's a way to add a real codebase (check in the tomcat-dev archives), but
you can't get rid of the stuff that's already there. I've thought about
writing a modified WebAppClasslLoader to support RMI better, but I don't
want the support headaches!
Workaround: Check which classes you're sending down the pipe (they're
probably arguments to an RMI method call). Could you have the instances
created on the RMI server and sent to you? They would then have the
server's codebase annotation rather than yours. This should also work with
a factory object that gets sent to you by the RMI server, so long as the
classes are not available in the local classpath. Repeat -- The classes
used as arguments in your RMI method calls should not be available in your
local WEB-INF/lib directory (although they'll have to implement interfaces
that are available locally). I suppose you could also create a
URLClassLoader pointing to your codebase and use it to create your
instances, but it seems like a lot of work, plus you still have the need to
implement locally-available interfaces.
Hope this helps,
Greg Trasuk, President
StratusCom Manufacturing Systems Inc. - We use information technology to
solve business problems on your plant floor.
http://stratuscom.ca
>-----Original Message-----
>From: David Esposito [mailto:[EMAIL PROTECTED]]
>Sent: December 09, 2002 10:18
>To: [EMAIL PROTECTED]
>Subject: RMI Class Annotation
>
>
>Hello all,
>
>My problem is this: I am running Tomcat 4.1 as an embedded
>service in JBOSS
>3.0.4 ... One of my servlets makes an RMI call to an RMI
>server running on a
>different box. The problem is that the classpath that JBOSS
>creates (and
>Tomcat inherits, i believe) is so large that it actually has
>an impact on
>the performance of the RMI method invocation. That is, the
>value returned by
>RMIClassLoader.getClassAnnotation() is over 35kilobytes!!
>
>Here's just a brief snippet:
>
>file:/C:/jboss-3.0.4-tomcat/tomcat-4.1.x/work/MainEngine/localh
>ost/testjms/W
>EB-INF/classes/
>file:/C:/jboss-3.0.4-tomcat/tomcat-4.1.x/work/MainEngine/localh
>ost/testjms/W
>EB-INF/lib/jbossall-client.jar
>file:/C:/jboss-3.0.4-tomcat/tomcat-4.1.x/work/MainEngine/localh
>ost/testjms/W
>EB-INF/lib/log4j.jar
>file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/tomcat-4.
1.x/common/li
>b/naming-common.jar/81.naming-common.jar
>file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/de
>fault/lib/jnp
>server.jar/17.jnpserver.jar
>file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/tomcat-4.
1.x/server/li
b/tomcat-jk.jar/85.tomcat-jk.jar
file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/lib/cou
nter-plugin.jar/38.counter-plugin.jar
file:/C:/jboss-3.0.4-tomcat/tomcat-4.1.x/server/classes/
file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/deploy/
jca-service.xml/45.jca-service.xml
file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/tomcat-4.1.x/server/li
b/commons-modeler.jar/86.commons-modeler.jar
file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/lib/jbo
ssmx.jar/2.jbossmx.jar
file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/lib/jbo
ss-j2ee.jar/16.jboss-j2ee.jar
file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/lib/mai
l-plugin.jar/20.mail-plugin.jar
This turns a 20ms RMI method invocation (when invoked from a standalone java
application) into a 800ms RMI method invocation (when invoked from the
servlet) because of all of the upstream bandwidth that is required ...
Needless to say, this is a problem ...
Does anyone have any input? I read a few messages that were posted about
this problem and someone commented that Tomcat is not behaving correctly;
that is, it's using the webapp's classloader's classpath instead of the RMI
codebase's classpath ... It seems to me that the RMIClassLoader should only
be concerned with classpaths set in the java.rmi.server.codebase?
Thanks in advance,
Dave
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>