Article View: es.comp.lenguajes.java
Article #26658Re: No puedo realizar una RMI
From: jmoya
Date: Wed, 09 Dec 1998 00:00
Date: Wed, 09 Dec 1998 00:00
210 lines
7860 bytes
7860 bytes
--------------BD21FE857EB5B2E50108A36B
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Hola paqui,
te has olvidado de poner el puerto 8080 en el URL:
http://tara:8080/~paqui/codebase/index.html
Juan Moya
paqui wrote:
> Hola, estoy intentando ejecutar la demo distribuida Hello World ,
> pero desconozco qu� parte del procedimiento estoy realizando
> incorrectamente para que la m�quina cliente no detecte el URL de mis
> clases en el servidor. Quiz�s t� puedas ayudarme.
>
> Instal� el JavaWebServer1.1 en mi cuenta de usuario en Unix (unidad k
> en WNT) y los ficheros fuente est�n situados en
> ~paqui/serverrmi/examples/hello/
> el fichero HTML en
> ~paqui/codebase/
>
> HelloImpl.java:
>
> System.setSecurityManager(new RMISecurityManager());
>
> try {
>
> System.out.println("HelloImpl.main: creating remote object");
>
> HelloImpl obj = new HelloImpl("HelloServer");
>
> System.out.println("HelloImpl.main: binding remote object");
>
> Naming.rebind("rmi://tara:2001/HelloServer", obj);
>
> System.out.println("HelloImpl.main: HelloServer bound in registry");
>
> } catch (Exception e) {
>
> System.out.println("HelloImpl.main: an exception occurred:"+e.getMessage());
>
> e.printStackTrace();
>
> }
>
> HelloApplet.java:
>
> try {
>
> System.out.println("HelloApplet.init: looking up HelloServer on the server...");
>
> Hello obj = (Hello)Naming.lookup("//tara:2001/HelloServer");
>
> System.out.println("HelloApplet.init: found it");
>
> message = obj.sayHello();
>
> } catch (Exception e) {
>
> System.out.println("HelloApplet: an exception occurred:");
>
> e.printStackTrace();
>
> }
>
> index.html:
>
> <applet
>
> code="examples.hello.HelloApplet"
>
> width=500 height=120>
>
> </applet>
>
> En WNT, a�ado al CLASSPATH k:\codebase
>
> k:\serverrmi\examples\hello>javac -d k:\codebase *.java
>
> k:\serverrmi\rmic -d k:\codebase examples.hello.HelloImpl
>
> Arranco el servidor sobre Solaris en una m�quina llamada tara sobre el
> puerto 8080, por defecto:
>
> paqui@tara%./httpd &
>
> paqui@tara%setenv CLASSPATH ~paqui/codebase
>
> paqui@tara%rmiregistry 2001 &
>
> paqui@tara%java -Djava.rmi.server.codebase=http://tara/~paqui/codebase/ examples.hello.HelloImp
>
> HelloImpl.main: creating remote object...
>
> HelloImpl.main: binding remote object...
>
> HelloImpl.main: HelloServer bound in registry.
>
> En la maquina cliente:
>
> k:\appletviewer http://tara/~paqui/codebase/index.html
>
> I/O exception while reading. Conection refused: no further information.
>
> Is http://tara/~paqui/codebase/index.html the correct URL?
>
> Muchas gracias de antemano.
--------------BD21FE857EB5B2E50108A36B
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hola paqui,
<p>te has olvidado de poner el puerto 8080 en el URL:
<br><font size=-1><a href="http://tara/~paqui/codebase/index.html">http://tara:8080/~paqui/codebase/index.html</a></font>
<p>Juan Moya
<p>paqui wrote:
<blockquote TYPE=CITE> Hola, estoy intentando ejecutar la demo
distribuida Hello World , pero desconozco qué parte del procedimiento
estoy realizando incorrectamente para que la máquina cliente no
detecte el URL de mis clases en el servidor. Quizás tú puedas
ayudarme.
<p>Instalé el JavaWebServer1.1 en mi cuenta de usuario en
Unix (unidad k en WNT) y los ficheros fuente están situados en
<br>~paqui/serverrmi/examples/hello/
<br>el fichero HTML en
<br> ~paqui/codebase/
<p>HelloImpl.java:
<pre><font size=-1> System.setSecurityManager(new RMISecurityManager());</font></pre>
<pre><font size=-1> try {</font></pre>
<pre><font size=-1> System.out.println("HelloImpl.main: creating remote object");</font></pre>
<pre><font size=-1> HelloImpl obj = new HelloImpl("HelloServer");</font></pre>
<pre><font size=-1> System.out.println("HelloImpl.main: binding remote object");</font></pre>
<pre><font size=-1> Naming.rebind("rmi://tara:2001/HelloServer", obj);</font></pre>
<pre><font size=-1> System.out.println("HelloImpl.main: HelloServer bound in registry");</font></pre>
<pre><font size=-1> } catch (Exception e) {</font></pre>
<pre><font size=-1> System.out.println("HelloImpl.main: an exception occurred:"+e.getMessage());</font></pre>
<pre><font size=-1> e.printStackTrace();</font></pre>
<pre><font size=-1> }</font></pre>
HelloApplet.java:
<pre> <font size=-1>try {</font></pre>
<pre><font size=-1> System.out.println("HelloApplet.init: looking up HelloServer on the server...");</font></pre>
<pre><font size=-1> Hello obj = (Hello)Naming.lookup("//tara:2001/HelloServer");</font></pre>
<pre><font size=-1> System.out.println("HelloApplet.init: found it");</font></pre>
<pre><font size=-1> message = obj.sayHello();</font></pre>
<pre><font size=-1> } catch (Exception e) {</font></pre>
<pre><font size=-1> System.out.println("HelloApplet: an exception occurred:");</font></pre>
<pre><font size=-1> e.printStackTrace();</font></pre>
<pre><font size=-1> }</font></pre>
index.html:
<pre><font size=-1><applet</font></pre>
<pre><font size=-1> code="examples.hello.HelloApplet"</font></pre>
<pre><font size=-1> width=500 height=120></font></pre>
<pre><font size=-1></applet></font></pre>
En WNT, añado al CLASSPATH k:\codebase
<pre><font size=-1>k:\serverrmi\examples\hello>javac -d k:\codebase *.java</font></pre>
<pre><font size=-1>k:\serverrmi\rmic -d k:\codebase examples.hello.HelloImpl</font></pre>
Arranco el servidor sobre Solaris en una máquina llamada tara sobre
el puerto 8080, por defecto:
<pre><font size=-1>paqui@tara%./httpd &</font></pre>
<pre><font size=-1>paqui@tara%setenv CLASSPATH ~paqui/codebase</font></pre>
<pre><font size=-1>paqui@tara%rmiregistry 2001 &</font></pre>
<pre><font size=-1>paqui@tara%java -Djava.rmi.server.codebase=<a href="http://tara/~paqui/codebase/">http://tara/~paqui/codebase/</a> examples.hello.HelloImp</font></pre>
<pre><font size=-1>HelloImpl.main: creating remote object...</font></pre>
<pre><font size=-1>HelloImpl.main: binding remote object...</font></pre>
<pre><font size=-1>HelloImpl.main: HelloServer bound in registry.</font></pre>
En la maquina cliente:
<pre><font size=-1>k:\appletviewer <a href="http://tara/~paqui/codebase/index.html">http://tara/~paqui/codebase/index.html</a></font></pre>
<pre><font size=-1>I/O exception while reading. Conection refused: no further information.</font></pre>
<pre><font size=-1>Is <a href="http://tara/~paqui/codebase/index.html">http://tara/~paqui/codebase/index.html</a> the correct URL?</font></pre>
Muchas gracias de antemano.</blockquote>
</html>
--------------BD21FE857EB5B2E50108A36B--
Technical Details
Message-ID:
<366EC568.33A8A0CB@mat.upc.es>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36656905.9641FF12@cma.ulpgc.es>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII X-Google-Thread: 1116f3,d0240cb98fd3d2cb X-Google-Attributes: gid1116f3,public From: jmoya <jmoya@mat.upc.es> Subject: Re: No puedo realizar una RMI Date: 1998/12/09 Message-ID: <366EC568.33A8A0CB@mat.upc.es> X-Deja-AN: 421417002 References: <36656905.9641FF12@cma.ulpgc.es> To: paqui <paqui@cma.ulpgc.es> X-Accept-Language: en Content-Type: multipart/alternative; boundary="------------BD21FE857EB5B2E50108A36B" Organization: Universitat Politecnica de Catalunya Mime-Version: 1.0 Newsgroups: es.comp.lenguajes.java