File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Distributed Java and the fly likes Problem in running client from seperate machine Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Problem in running client from seperate machine" Watch "Problem in running client from seperate machine" New topic

Problem in running client from seperate machine

Sandeep Ghosh

Joined: Mar 10, 2001
Posts: 22
Hi all,
I am new to RMI. I have compiled the codes posted by Aj Manch in win2000.
which are as follows
//remote interface
package compute;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Compute extends Remote
Object executeTask() throws RemoteException;
//server implementation
package engine;
import java.rmi.*;
import java.rmi.server.*;
import compute.*;
public class ComputeEngine extends UnicastRemoteObject implements Compute
public ComputeEngine() throws RemoteException
public Object executeTask()
return "Invoked executeTask.";
public static void main(String[] args)
if (System.getSecurityManager() == null)
System.setSecurityManager(new RMISecurityManager());
String name = "//localhost/Compute";
try {
Compute engine = new ComputeEngine();
Naming.rebind(name, engine);
System.out.println("ComputeEngine bound");
} catch (Exception e)
System.err.println("ComputeEngine exception: " + e.getMessage()); e.printStackTrace();
//policy file
grant {
permission "*:1024-65535","connect,accept";
permission "*:80", "connect";
In addition to this I have written the client part as follows.
import compute.Compute;
import java.applet.Applet;
import java.awt.Graphics;
import java.rmi.*;
import java.rmi.server.*;
public class HelloApplet extends Applet{
String message="blank";
Compute obj= null;
public void init(){
message =(String)obj.executeTask();
catch (Exception e){
System.out.println("HelloApplet exception:"+ e.getMessage());
public void paint(Graphics g){
g.drawString(message, 25, 50);
In the server machine IIS server is running and I have added a virtual directory with Alias "Compute".When I am running the server and client from same machine it is working but when I am taking client to different machine it is giving following error access denied ( connect,resolve)
at, Compiled Code)
at java.lang.SecurityManager.checkPermission(, Compiled Code)
at java.lang.SecurityManager.checkConnect(
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(
at sun.rmi.transport.tcp.TCPChannel.createConnection(
at sun.rmi.transport.tcp.TCPChannel.newConnection(
at sun.rmi.server.UnicastRef.newCall(
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(
at HelloApplet.init(

could anybody give me the solution to the above problem.'
Thanks in advance

I agree. Here's the link:
subject: Problem in running client from seperate machine
It's not a secret anymore!