» »

RMI

RMI

mov ax 0x7c0 ::

Zdravo!

Rad bi napisal preprost RMI server in Client (no ja, sem jih že). Imam pa problem z zagonom Clienta! Server mi dela! Ko zaženem Client z ukazom:
java -Djava.security.policy="c:\path\"policy Client

mi javi tole izjemo:

HelloImpl err: Error unmarshaling return header; nested exception is:
java.io.EOFException
java.rmi.UnmarshalException: Error unmarshaling return header; nested exception
is:
java.io.EOFException
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
203)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:350)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at Client.main(Client.java:15)
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:333)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
189)
... 3 more

kaj to za vraga pomeni?
koda HelloImpl.java:
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.server.RemoteServer;
import java.rmi.server.ServerNotActiveException;

public class HelloImpl extends UnicastRemoteObject implements Hello
{
public HelloImpl() throws RemoteException {
super();
}

public String sayHello(String arg) throws RemoteException {
String client;

try {
client = RemoteServer.getClientHost();
}
catch (ServerNotActiveException e) {
client = "*unknown*";
}

System.out.println("Server received from host " + client + " following message: " + arg);

return "Server says hi!";
}
}

koda Client.java:
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;

public class Client
{
public static void main(String args[]) {
// get host where registry is running
String host = args.length>0 ? args[0] : "localhost";

try {
// get reference to registry
Registry registry = LocateRegistry.getRegistry(host, 5001);

// connect to remote object via registry
Hello obj = (Hello)registry.lookup("/HelloServer");

// invoke remote method
String ret_value = obj.sayHello("Hi from client!");

// print return value
System.out.println("Message from server: " + ret_value);
}
catch (Exception e) {
System.out.println("HelloImpl err: " + e.getMessage());
e.printStackTrace();
}
}
}

prosim če keri vidi kakšno napako naj pove kaj je! Ker se že Fu**m cel dan s tem, čitam toturiale pa nikjer ni opisam ta problem...

lp, Slavc


Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

Web services - Neveljavni karakterji v XML

Oddelek: Programiranje
314161 (3273) boolsheat
»

Java - problem povezave na FTP

Oddelek: Programiranje
101190 (1047) igor0203
»

tomcat in datasource

Oddelek: Programiranje
132026 (1783) infiniteLoop
»

[JAVA] zaustavitev niti (threadov)

Oddelek: Programiranje
223183 (3183) morbo
»

Kako pošiljanje datotek v JAVI.

Oddelek: Programiranje
141844 (1715) kopernik

Več podobnih tem