ClassCastException using SwingUtilities.invokeLater() method
posted 13 years ago
I am have an RMI Swing app using JWS that is performing callbacks on the client. I have read that when using JWS with an RMI swing app that the events that the server sends to the client via RMI are handled within a different thread queue than the GUI event queue. So to handle this situation I have tried using SwingUtilities.invokeLater(). The Runnablel class that I am passing into the invokeLater() has code within it that talks to the Server via RMI and by having this code in the run() of the runnable class it is generating ClassCastExceptions. I have placed printlns in the code to see if the class isnt of the type I am casting to but this is not the case. I have a ServiceFactory.getAdminService() which casts to AdminService. I can see by using : Remote remoteObj = Naming.lookup(lookupURL); System.out.println("remoteObj type: " + remoteObj.getClass()); That the remote object being returned is of type AdminServiceImpl_Stub which is the RMI stub (this is how it has always worked). But for some reason I am getting a class cast exception. Any suggestions are greatly appreciated! Thanks!