Desculpem o transtorno
O Codigo HTML que executa o applet e o seguinte:
applet code="HelloApplet"
width=500 height=120>
/applet>
>From: "emilio lemos" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: [SouJava-J] Problemas com RMI
>Date: Mon, 20 Mar 2000 20:17:22 GMT
>
>Prezados Amigos
>
>Estou enfrentando alguns problemas para fazer funcionar
>um exemplo envolvendo RMI. De acordo com o exemplo, o resultado sera a
>apresentacao do texto "Hello World" num browser que contem um applet.
>
>Aqui estao alguns detalhes de minha configuracao:
>
>Uso o Windows 95
>
>JDK1.2
>
>Diretorio onde foram gravados os fontes : C:\MYSRC
>
>Nao tenho nenhum servidor Web local instalado.
>
>A compilacao dos codigos fontes funciona sem problemas
>javac Hello.java HelloImpl.java HelloApplet.java
>
>A geracao dos "skeletons" "stubs" funciona ok atraves do comando
>rmic HelloImpl
>
>O comando start rmiregistry funciona ok
>
>O comando java -D java.rmi.server.codebase=HelloImpl da o seguinte erro:
>Exception in thread "main" java.lang.NoClassDefFoundError:
>java/rmi/server/codebase=HelloImpl
>
>* Deste ponto eu nao passei
>
>O exemplo completo pode ser encontrado em
>
>http://java.sun.com/products/jdk/1.1/docs/guide/rmi/getstart.doc.html
>
>
>Agradeco qualquer colaboracao
>
>
>// 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 World!";
> }
>
> public static void main(String args[]) {
>
> // Create and install a security manager
> if (System.getSecurityManager() == null) {
> System.setSecurityManager(new RMISecurityManager());
> }
> try {
> HelloImpl obj = new HelloImpl();
> // Bind this object instance to the name "HelloServer"
>
>// Fiz uma mudanca nesta linha. A linha original e
>// Naming.rebind("//myhost/HelloServer",obj);
>
> 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();
> }
> }
>}
>
>
>
>
>
>// HelloApplet.java
>
>import java.applet.Applet;
>import java.awt.Graphics;
>import java.rmi.Naming;
>import java.rmi.RemoteException;
>
>public class HelloApplet extends Applet {
>
> 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;
>
> public void init() {
> try {
> obj = (Hello)Naming.lookup("//" +
> getCodeBase().getHost() + "/HelloServer");
> message = obj.sayHello();
> } catch (Exception e) {
> System.out.println("HelloApplet exception: " +
> e.getMessage());
> e.printStackTrace();
> }
> }
>
> public void paint(Graphics g) {
> g.drawString(message, 25, 50);
> }
>}
>
>
>// Hello.html
>
><HTML>
><title>Hello World</title>
><center> <h1>Hello World</h1> </center>
>
>The message from the HelloServer is:
><p>
><applet code="HelloApplet"
> width=500 height=120>
></applet>
></HTML>
>
>
>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com
>
> --------------------------- 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]
> [para sair da lista: http://www.soujava.org.br/forum/cadastrados.htm]
> ---------------------------------------------------------------------
>
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
--------------------------- 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]
[para sair da lista: http://www.soujava.org.br/forum/cadastrados.htm]
---------------------------------------------------------------------