[an error occurred while processing this directive]

RMI: Programmer's Checklist

Source

The Remote interface

The server (implementation of the interface)

The client

Compile

Compile all the .java files as usual.

Run

Specify a policy file that allows downloading of your classes

An example of a policy file that is sufficient (but dangerously permissive) is:

grant 
{ 
  // Allow everything for now 
  permission java.security.AllPermission; 
};
	

Establish the code base:

Make a codebase for all client classes that the server needs but does not have in its classpath (e.g., classes of Remote method parameters)

Specify the codebase when you run the server

For example, the command below runs a Java application called Application. In this case, the system expects the policy file called policy to be in the directory from which the java command executes.

java -Djava.rmi.server.codebase=http://www.cs.ucsb.edu/~cappello/classes/ \ 
     -Djava.security.policy=policy                                        \ 
      Application 
	

I need class files in my public_html/classes directory to be readable by all. The classes directory needs to be readable and executable by all. The trailing slash on the codebase specification is crucial.

Runtime Exceptions

java.io.NotSerializableException
The object, Obj, in question either:
java.security.AccessControlException: access denied
The JVM may not have access to a policy file, either because it is missing or unreadable, or the specification of where it is (on the command line) is incorrect.
[an error occurred while processing this directive]