[Java lista] RMI segítség

Koller Pál koller.pal at novohost.hu
2006. Nov. 20., H, 09:48:23 CET


HALI!

>192.168.0.3-on nem fut az rmiregistry. Tolj egy ifconfig
>es egy netstat -nat outputot.
	 
>Ha nem futtatsz mas RMI szervert, akkor egyebkent szerintem
>erdemes lehet a processen belul letrehozni a registry-t. 
>(Lasd LocateRegistry javadoc.)

Ez nagyon király gondolhattam volna erre. 
Most már legalább elindul a server. 

linux:/opt/nfs-share/rmi # netstat -nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address
State
...
tcp        0      0 :::1099                 :::*
LISTEN
...

DE.

A kliens indításakor:

linux:/opt/nfs-share/rmi # ./client =(java
-Djava.security.policy=policy.all SampleClient) Security Manager loaded
NotBound: SAMPLE-SERVER
java.rmi.NotBoundException: SAMPLE-SERVER
        at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:106)
        at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
        at
sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:342)
        at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207)
        at sun.rmi.transport.Transport$1.run(Transport.java:148)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
        at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
        at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.ja
va:701)
        at java.lang.Thread.run(Thread.java:534)
        at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRem
oteCall.java:247)
        at
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223
)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:350)
        at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
        at java.rmi.Naming.lookup(Naming.java:84)
        at SampleClient.main(SampleClient.java:19)

Nincs regisztrálva a kért osztály. Gondolom én.


SampleServerImpl részlet.

        SampleServerImpl Server = new SampleServerImpl();
        System.setSecurityManager(new RMISecurityManager());
	
java.rmi.registry.LocateRegistry.createRegistry(1099).bind("//localhost/
SAMPLE-SERVER" , Server);
        System.out.println("Server waiting.....");

Csont nélkül lefut.

SampleClient részlet

      System.setSecurityManager(new RMISecurityManager());
      try
        {
          String url = "//localhost:1099/SAMPLE-SERVER";

          SampleServer remoteObject = (SampleServer) Naming.lookup(url);
NotBoundException

Miért????

A szerver figyel, mert ha lelövöm akkor 
        Error in lookup: Connection refused to host: localhost; nested
exception is:
                         java.net.ConnectException: Connection refused
Hiba jön






További információk a(z) Javalist levelezőlistáról