Wednesday, February 08, 2006

RMI is pretty evil

new problems and their solutions:

any time you get an exception having to do with marshaling and you know that you have not changed any of your stubs, then its a codebase error! to fix:

System.setProperty("java.rmi.server.codebase","http://website.com/codebase/");
into that directory you can put your stubs, tho there is a little catch there. you have to put them in like this
http://website.com/codebase/package1/subpackage/Class_Impl_Stub.class
if the fully qualified name ofr Class_Impl_Stub is package1.subpackage.Class_Impl_Stub

people on the interweb say that using an http address is less troublesome then trying to use a file:// url

also, put your policy file into the same directory as your main jar file.

here is a good command line example of how i start my server:
>rmiregistry&
>java -Djava.rmi.server.hostname=134.88.14.133 -Djava.rmi.server.codebase=http://website.com/mk/codebase/ -Djava.security.policy=./policy.all -jar server.jar

note that server.jar contains a manifest file that points to all the libs it needs.

your client app should also have this codebase declaired obviously.

No comments:

Post a Comment