• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in running client from seperate machine

 
Sandeep Ghosh
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
{
super();
}
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 java.security.AllPermission;
permission java.security.AllPermission;
permission java.net.SocketPermission "*:1024-65535","connect,accept";
permission java.net.SocketPermission "*: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(){
try{
obj=(Compute)Naming.lookup("//192.168.25.1/Compute");
message =(String)obj.executeTask();
}
catch (Exception e){
System.out.println("HelloApplet exception:"+ e.getMessage());
e.printStackTrace();
}
}
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
java.security.AccessControlException: access denied (java.net.SocketPermission 192.168.25.1:1099 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:195)
at java.security.AccessController.checkPermission(AccessController.java, Compiled Code)
at java.lang.SecurityManager.checkPermission(SecurityManager.java, Compiled Code)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1021)
at java.net.Socket.<init>(Socket.java:258)
at java.net.Socket.<init>(Socket.java:98)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:29)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:124)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:497)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:194)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:178)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:89)
at HelloApplet.init(HelloApplet.java:26)
at sun.applet.AppletPanel.run(AppletPanel.java:333)
at java.lang.Thread.run(Thread.java:479)

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

------------------
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic