Hello,
I get a strange error message from my test rmi client. (Client is run on localhost, just for testing)
The exception is:
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.net.MalformedURLException: unknown protocol: rsrc
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at sep.tukl.client.Client.main(Client.java:27)
Caused by: java.net.MalformedURLException: unknown protocol: rsrc
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
...
...
I cant find anything on google or in these forums about this exception.
Can anyone help me?
greetings
Raptor
Client
public static void main(String[] args) {
System.setProperty("java.security.policy", "java.policy");
if (System.getSecurityManager() == null) {
System.setSecurityManager(new SecurityManager());
}
try{
Registry r = LocateRegistry.getRegistry(6666);
DVMService h = (DVMService) r.lookup("DVM");
System.out.println(h);
} catch (Exception e){
e.printStackTrace();
}
}
Server
private void startRMIRegistry(){
System.setProperty("java.security.policy", "java.policy");
if(System.getSecurityManager()==null){
System.setSecurityManager(new RMISecurityManager());
}
try {
LocateRegistry.createRegistry(rmiPort);
} catch (RemoteException e) {
e.printStackTrace();
}
}
private void registerRMI() throws AccessException, RemoteException, AlreadyBoundException, MalformedURLException{
dvmservice = new DVMServiceImpl(this);
DVMService d = (DVMService) UnicastRemoteObject.exportObject(
dvmservice, 0);
LocateRegistry.getRegistry(rmiPort).rebind("DVMService", d);
}
private void unregisterRMI() throws AccessException, RemoteException,
NotBoundException {
LocateRegistry.getRegistry(rmiPort).unbind("DVM");
UnicastRemoteObject.unexportObject(dvmservice, false);
UnicastRemoteObject.unexportObject(registry, false);
}
private void startCodebaseWebserver() {
try {
new NanoHTTPD(httpdPort);
System.setProperty("java.rmi.server.codebase", control.codebaseURL
+ ":" + httpdPort + "/Server.jar");
} catch (IOException e) {
Logger.fatal("ServerController : " + e.getMessage());
}
}