Problema com RMI's

0 respostas
P

Viva
Tou a ter uns problemas em arrancar um modelo cliente.servidor multithreaded atraves de RMI's..
da parte do cliente começo assim

public Game() throws RemoteException{
		//gameGuis=new LinkedList();
		super();
		try {
			if((serv = (Servidor) Naming.lookup("//localhost:12345/Servidor"))==null) System.out.println("Lookup bem sucedido");
		} catch (MalformedURLException e) {
			System.out.println("GAME[43]");
			e.printStackTrace();
		} catch (NotBoundException e) {
			System.out.println("GAME[46]");
			e.printStackTrace();
		} 

[b]e tambem[/b]
if(System.getSecurityManager()==null) {
			System.getProperties().put("java.security.policy", "policy.all");
			System.setSecurityManager(new RMISecurityManager());
			System.out.println("CRIADO RMI SECURITY MANAGER");
		}
da parte do servidor, assim
public static void main(String[] args) {
		
		if(System.getSecurityManager()==null) {
			System.getProperties().put("java.security.policy", "policy.all");
			System.setSecurityManager(new RMISecurityManager());
		}
		
		try{
			Servidor jogo= new Servidor();
			Registry registry = LocateRegistry.createRegistry(12345); 
			registry.rebind("Servidor", jogo); 
			System.out.println("Servidor Pronto");

e ao correr o cliente, dá-me este erro:

Exception in thread "main" java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:12345 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
at java.security.AccessController.checkPermission(AccessController.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1034)
at java.net.Socket.connect(Socket.java:510)
at java.net.Socket.connect(Socket.java:466)
at java.net.Socket.(Socket.java:366)
at java.net.Socket.(Socket.java:179)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:306)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:84)

Alguem me consegue ajudar? desculpem o tamanho do post

Criado 8 de novembro de 2006
Respostas 0
Participantes 1