I'm working with quartz-2.2.1 using http URLs in the codebase and have made it to 1st base with codebase and security managers.
I have two questions about RMI classloading:
1) Can jars be requested via http RMI? I specify a single jar containing the complete application in the the codebase URL passed to the client. Even though the jar is requested and "served" by the http server, the server continues to receive requests for classes that are contained in libraries included in the jar.
Any ideas what's going on here? I would expect the server to add the jar to its classpath but this does not seem to be the case.
I didn't notice any methods in RMIClassLoader that handle anything other than classes.
2) Can RMI request objects other than classes? I finally figured out how to serve classes from jars (to solve the above problem) but the remote job fails trying to load a ".txt" resource. It is contained in the application jar, but the http server never sees the request.
I am also wondering if these issues are common to RMI in general or specific to Quartz.
As this is my first foray into RMI, any and all comments will be very much appreciated.
Yes.
That's normal.
Aha. 'libraries included in the jar' may not work. You should provided them separately via further codebase URLs. The
java.rmi.server.codebase
property is a list of URLs, not just one.It ultimately adds a
URLClassLoader
to its classloader set.You need to note that
RMIClassLoader
isn't really aClassLoader
. It's a strange beast but its class loading is ultimately delegated to aURLClassLoader.
The codebase feature is for anything you can retrieve via a classloader, including resources, if they are obtained via
getResource()
and friends.There wouldn't be such a request to see. It should be loaded straight from the .jar file, which has already been downloaded. Check that you are referring to the resource correctly.