• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Rmi BAsic Problem

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

}

}
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hope this example will help

The Remote interface

Client

Hope this example will help
Jawad
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes persmission really Solve my problem , thanks Alot
 
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic