wood burning stoves 2.0*
The moose likes Distributed Java and the fly likes Rmi BAsic Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Rmi BAsic Problem" Watch "Rmi BAsic Problem" New topic
Author

Rmi BAsic Problem

Muhammad Ammad Husain
Greenhorn

Joined: Oct 16, 2002
Posts: 20
import java.rmi.*;
import java.rmi.server.*;
import java.rmi.registry.*;
import java.net.*;
class Implement extends UnicastRemoteObject implements Rmi {
public Implement()
throws RemoteException{
}
public void print()
throws RemoteException {
System.out.println("Printing");
}
public static void main(String args[]){
try {
System.setSecurityManager(new RMISecurityManager());
Implement a = new Implement();
Registry reg = LocateRegistry.createRegistry(2005);
reg.rebind("Implement",a);
}catch (Exception E){
System.out.println(E.getMessage());
}
////////////////////////////////////////////////
import java.rmi.*;

interface Rmi extends Remote{
void print() throws RemoteException;
}
///////////////////////////////////////
import java.rmi.*;
import java.rmi.server.*;
import java.rmi.registry.*;
import java.net.*;
class Test {
public static void main(String args[]){
try {
System.setSecurityManager(new RMISecurityManager());
Registry reg = LocateRegistry.getRegistry("personal",2005);
Rmi r = (Implement)reg.lookup("Implement");//Naming.lookup("//personal:2005/Implement");
r.print();
}catch (Exception E){
System.out.println(E.getMessage());
}
}
}
///////////////////////////////////////////////
These are three simple files every thing seems to Ok But when i run Client Message appears stating that,
acess denied, (java.net.socketPermission,Personal resolve)
I have tried every thing but didnt got any resuce.
Plz Send me atleat simplfied code to over come this problem

}

}
Jawad Kakar
Ranch Hand

Joined: Oct 06, 2002
Posts: 82
I hope this example will help

The Remote interface

Client

Hope this example will help
Jawad
Javan Li
Ranch Hand

Joined: Jul 24, 2002
Posts: 84
I guess u need a policy file. like this:

grant {
permission java.net.SocketPermission "*:1024-65535", "accept, connect,listen";
permission java.io.FilePermission "<<ALL FILES>>", "read, write, delete, execute";
};
Muhammad Ammad Husain
Greenhorn

Joined: Oct 16, 2002
Posts: 20
Yes persmission really Solve my problem , thanks Alot
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Rmi BAsic Problem