Java remote method invocation: Difference between revisions

Content deleted Content added
Example: fixed various coding errors and removed unnecessary SecurityManager
Example: Further removal of security manager stuff, not required in a simple example.
Line 117:
</source>
Note that since version 5.0 of J2SE support for dynamically generated stub files has been added, and rmic is only provided for backwards compatibility with earlier run times.<ref>{{cite web|title=Jave RMI Release Notes|url=http://docs.oracle.com/javase/1.5.0/docs/guide/rmi/relnotes.html|publisher=Oracle|accessdate=9 May 2012}}</ref>
Note that to use this feature the remote object must provide an explicit port number, or zero, when exporting itself, as noted in the comment in the constructor above.
 
'''<code>server.policy</code>''' &mdash; this file is required on the server to allow TCP/IP communication for the remote registry and for the RMI server.
 
<source lang=java>
grant {
permission java.net.SocketPermission "127.0.0.1:*", "connect,resolve";
permission java.net.SocketPermission "127.0.0.1:*", "accept";
};
</source>
 
The server.policy file should be used using the D switch of Java RTE, e.g.:
<source lang=dos>
java -Djava.security.policy=server.policy RmiServer
</source>
 
'''<code>client.policy</code>''' &mdash; this file is required on the client to connect to RMI Server using TCP/IP.
<source lang=java>
grant {
permission java.net.SocketPermission "127.0.0.1:*", "connect,resolve";
};
</source>
 
'''<code>no.policy</code>''' &mdash; also if you have any troubles with connecting, try this file for server or client.
 
<source lang=java>
grant {
permission java.security.AllPermission;
};
</source>
 
==References==