OL� Grupo..

estou com problemas usando RMI, coloco o Servidor para rodar e 
acesso com um cliente pela maquina local funciona. qdo tento acessar 
por uam maquina externa ele da erro.

Abaixo segue os arquivos q estou usando:

Client.policy

grant 
{ 
permission java.security.AllPermission; 
};

Hello.java

import java.rmi.Remote; 
import java.rmi.RemoteException; 

    public interface Hello extends Remote { 
        String sayHello() throws RemoteException; 
    } 


HelloImpl.java

import java.rmi.Naming; 
     import java.rmi.RemoteException; 
     import java.rmi.RMISecurityManager; 
     import java.rmi.server.UnicastRemoteObject; 

     public class HelloImpl extends UnicastRemoteObject implements 
Hello { 

         public HelloImpl() throws RemoteException { 
             super(); 
         } 

         public String sayHello() { 
             return "Hello Worl456d!"; 
         } 

         public static void main(String args[]) { 

             // Create and install a security manager 
             System.setProperty
("java.security.policy", "client.policy");
             
             System.setSecurityManager(new RMISecurityManager()); 

             try { 
                 HelloImpl obj = new HelloImpl(); 

                 // Bind this object instance to the 
name "HelloServer" 
                 Naming.rebind("//127.0.0.1/HelloServer", obj); 

                 System.out.println("HelloServer bound in 
registry"); 
             } catch (Exception e) { 
                 System.out.println("HelloImpl err: " + e.getMessage
()); 
                 e.printStackTrace(); 
             } 
         } 
     } 
}

HelloClient.java

import java.rmi.Naming;

public class HelloClient { 


        static void inicio(){
                
                  String message = "blank"; 
  
   // "obj" is the identifier that we'll use to refer 
   // to the remote object that implements the "Hello" 
   // interface 
           Hello obj = null; 
      try { 
           obj = (Hello)Naming.lookup
("//201.5.229.247/HelloServer"); 
           message = obj.sayHello(); 
           System.out.println(message);
      } 
      catch (Exception e) { 
        System.out.println("HelloApplet exception: " + e.getMessage
()); 
         e.printStackTrace(); 
      }  
   } 
        
   public static void main (String args[]) { 
    inicio();
   }
} 

COnto com  a ajuda d evcs.

Obrigado

Anderson





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/5cFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/jug-petropolis/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Atrašyti