Jigsaw & RMI (Solution & Guideline)

Hi, 

	having had  a long boring debugging session I found a solution to
my problem posted to that list yesterday. Since the problems I encountered
might be of general interest for anyone trying to use RMI & Jigsaw I'll
describe.

	1.) Do NOT use the security manager supplied with SUN's JSDK (Java
Servlet Development Kit) The call 

	System.setSecurityManager(new RMISecurityManager());

	is obsolete, you can use RMI without that. If you install the
RMISecurityManager anyway you'll experience strange exceptions beeing
thrown after you're servlet has been loaded by Jigsaw.

	[TO THE JIGSAW TEAM] This little caveat should be really mentioned
in the Servlet-Tutorial, since one can get confused by not knowing what is
wrong, the servlet, the server, the configuration or sth. else.

	2.) Make sure, that jigsaw cannot find the Stubs in the CLASSPATH.
If it does, it'll not respect the Stubs in the servlet directory. This can
be tricky since some wrapper scripts (e.g. JDK for Linux) are including
the current directory (.) in the CLASSPATH. Debugging this problem is
really boring: sometimes it works, sometimes not -- depending from where
you started the server.

	3) If your Stubs are in a package say foo.xxx, you have to create
a appropriate directory structure under your servlet directory in order to
find the stubs: e.g. /servlets/foo/xxx/Myclass_Stub.class.

	[TO THE JIGSAW TEAM] it was not completely clear to me whether I
had to build the package-directory structure here or just had to put the
Stubs in the servlet directory -- it could be explained more detailed in
the Servlet-Tutorial.

	4) As I mentioned in my last mail I had trouble with loading the
stub classes. I found out later that the real problem was not (only) the
Stub-class itself, but also the lack of the interface that I implemented
in the server. It needed to be copied into the appropriate directory
(with respect to its packages) too. In my case the Interface was even in a
different package, and the Classloader (of Jigsaw?) complained only about
the missing stub-file, but not about the interface that it extends. 

	[TO THE JIGSAW TEAM] Is that a bug or a feature? I really had a
hard time to regocnize the problem described about. If the behavior of the
jigsaw-classloader is o.k. I'd recommend to make a note about the need for
the interface class in the tutorial.

	5) As far as I know, the Client loading of Stub classes via
rmiregistry and java.rmi.server.codebase-property described in SUN's
RMI-Docs are not working at all. Experiments with jigsaw and RMI showed
that Application clients could load the stubs remotly, but Servlet-clients
couldn't. Could anyone verify that?

	[TO THE JIGSAW TEAM] If loading of Stub classes does not work at
all it should be noted in the tutorial, if it does, more detailed
exmplanation is needed.

	In summary the problems I encountered are minor ones, at present
RMI and Jigsaw works fine, but it took me several days to get to this
stage. I'd really wish a more detailed tutorial, covering the mentioned
issues.

	Regards, 

	Karten Boehm.  

Received on Friday, 19 March 1999 03:19:45 UTC