Alexandre,

    Coloque um construtor em B lancando a Exceção RemoteException

public B() throws RemoteException{ }

    Espero ter ajudado

    []'s

Elvis

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 14, 2002 7:33 PM
Subject: [java-list] Erro em compilação RMI!



Olá Pessoal da Lista,

      Estou tendo o seguinte erro,  o que acontece ? estou seguindo um
monte de exemplos e o seu exercício de aula e está dando este erro na
compilação...

C:\RMI>javac -classpath .;C:\RMI   B.java

      B.java:7: unreported exception java.rmi.RemoteException; must be
caught or declared to be thrown
      class B extends UnicastRemoteObject implements InterB {
      ^
1 error

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

public interface InterB extends Remote {

      public int soma(int x, int y) throws RemoteException;

}



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

public class B extends UnicastRemoteObject implements InterB {


      public int soma (int x, int y) throws RemoteException {
                  return x + y;
      }


      public static void main (String argv[])
      {
            if (System.getSecurityManager() == null)
            {
                System.setSecurityManager(new RMISecurityManager());
            }

            try {

                        B b = new B();

                        Naming.rebind("rmi://localhost:1099/nick", b);
                  }
                  catch (Exception e)
                  {
                 System.out.println("Erro: " + e.getMessage());
                 e.printStackTrace();
                  }
      }
}


CONFIDENTIALITY : This  e-mail  and  any attachments are confidential and
may be privileged. If  you are not a named recipient, please notify the
sender immediately and do not disclose the contents to another person, use
it for any purpose or store or copy the information in any medium.



CONFIDENTIALITY : This  e-mail  and  any attachments are confidential and
may be privileged. If  you are not a named recipient, please notify the
sender immediately and do not disclose the contents to another person, use
it for any purpose or store or copy the information in any medium.


------------------------------ LISTA SOUJAVA ----------------------------
http://www.soujava.org.br  -  Sociedade de Usuários Java da Sucesu-SP
dúvidas mais comuns: http://www.soujava.org.br/faq.htm
regras da lista: http://www.soujava.org.br/regras.htm
historico: http://www.mail-archive.com/java-list%40soujava.org.br
para sair da lista: envie email para [EMAIL PROTECTED]
-------------------------------------------------------------------------


------------------------------ LISTA SOUJAVA ---------------------------- 
http://www.soujava.org.br  -  Sociedade de Usuários Java da Sucesu-SP 
dúvidas mais comuns: http://www.soujava.org.br/faq.htm
regras da lista: http://www.soujava.org.br/regras.htm
historico: http://www.mail-archive.com/java-list%40soujava.org.br
para sair da lista: envie email para [EMAIL PROTECTED] 
-------------------------------------------------------------------------

Reply via email to