Java RMI problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Java RMI problem

  1. #1
    Join Date
    Nov 2005
    Posts
    5

    Java RMI problem

    Hi guys,

    I am having a strange problem using Java RMI. I am building a chat program in Java 5 Tiger, using the RMI framework and Java seems to be caching one of my interface implementations, as when I change a line of code, it still seems to use a previous one.

    An example is:

    the first line of code i had, which i was using to test that the server side was sending RMI messages back to the client side, which worked and printed the message out as required.


    Code:
    public void recvBroadcast(String userName,String message) throws  java.rmi.RemoteException{
            System.out.println(userName + "says: " + message);
    }
    I then changed the code to below, but I still got the same message printed out to screen, rather than to the required textPane.

    Code:
    public void recvBroadcast(String userName,String message) throws  java.rmi.RemoteException{
            gui.txtPaneChat.setText(userName + "says: " + message);
    }
    I am thinking that perhaps i need to clear the java cache, or rmiregistry or something but I do not know how to do this.

    Please help, this is very frustrating!

    Cheers guys

  2. #2
    Join Date
    Oct 2004
    Posts
    311
    Did you try stopping and starting the RMI registry?
    Or perhaps generate a new proxy / stub?

  3. #3
    Join Date
    Nov 2005
    Posts
    5
    Yes, I have indeed tried to restart the rmiregistry.

    I am affraid I do not know how to generate a new proxy / stub. Could you elaborate please?

    Thank you

  4. #4
    Join Date
    Oct 2004
    Posts
    311
    Well, to get the RMI to work in the first place, you have to do some things with your code and a external program, which generates 2 new class files, the proxy and the stub. (I'm not sure about the name of the program since I don't have my books here...)

    It might be that you accidentally deleted you class file directory, which holds those files.

  5. #5
    Join Date
    Nov 2005
    Posts
    5
    I do not that this is the problem because RMI is working because I am successfuly connecting to the server and it is indeed connecting and returning data to the client.

    Unfortunately, the data is being sent to the command window rather that the gui, as though it is reading the System.out.println instead of the txtPane.setText() line of code.

    I am utterly confused as the program continues to print out this line of code that does not exist!

    Any more suggestions would be most welcome.

    Thank you

  6. #6
    Join Date
    Oct 2004
    Posts
    311
    Did you delete you class files before recompiling?
    because I discovered that sometimes the compiler doesn't overwrite classfiles already there, even though they have changed.

Similar Threads

  1. Replies: 3
    Last Post: 03-21-2007, 04:28 PM
  2. java problem
    By Morgan in forum Java
    Replies: 2
    Last Post: 04-18-2005, 04:22 PM
  3. java problem
    By KateP in forum Java
    Replies: 2
    Last Post: 04-30-2003, 06:52 PM
  4. An open invitation
    By Chris P. in forum Java
    Replies: 0
    Last Post: 12-04-2000, 08:52 PM
  5. Java RMI contract
    By Edmond Melkomian in forum Java
    Replies: 0
    Last Post: 04-21-2000, 02:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center