Results 1 to 2 of 2
Thread: RMI RemoteException Problem
- 09-22-2011, 09:33 PM #1
Member
- Join Date
- Apr 2011
- Posts
- 6
- Rep Power
- 0
RMI RemoteException Problem
Hi all,
I am experimenting with creating a very basic IM app in which two or more clients can connect to a server, and send messages, which will then be broadcast to all clients. I am using RMI so that upon sending a message to the server, the client can then invoke the method on the server to read a stream and then process the input accordingly.
However when I try and run the server, I get a RemoteException. Here is my code to initialize the server;
This seams to run without throwing any of these errors, however the class with the main() method that initialises the server throws the following error:Java Code:public Server() throws RemoteException { try { Naming.rebind("Aaron_Server", this); } catch(MalformedURLException e) { System.out.println("Error Block 1: " + e); } try { System.out.println("Bound"); ServerSocket listener = new ServerSocket(1234); client = listener.accept(); } catch(Exception e) { System.out.println("Error Block 2: " + e); } try { in = client.getInputStream(); out = client.getOutputStream(); RClient = (RemoteClient)Naming.lookup("rmi://localhost/IM_Client"); ServerRun.addClient(RClient.getName()); } catch (IOException ioe) { System.out.println("Error Block 3: " + ioe); } catch (NotBoundException nbe) { System.out.println("Error Block 4: " + nbe); } }
Here is the code from the main() method:Java Code:Error Block 7: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: com.aaron_durant.im_server.RemoteServer
Eclipse forces me to declare that the constructor for the server throws a RemoteException, but I do not understand why it is being thrown as the code seems to run properly. However this error stops me from connecting a client to it.Java Code:try { svr1 = new Server(); System.out.println("Created"); } catch (Exception e) { System.out.println("Error Block 7: " + e); }
Please could someone explain this problem to me and help me to fix it.
Thanx
Aaron
- 11-08-2011, 11:05 PM #2
Member
- Join Date
- Nov 2011
- Posts
- 2
- Rep Power
- 0


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks