Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 903801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:56:48+00:00 2026-05-15T15:56:48+00:00

I successfully created an RMI service and client. I can call methods and so

  • 0

I successfully created an RMI service and client. I can call methods and so on. But now I wanted to try the following: I wanted a standard Java object like a LinkedList to be hosted on the service.
Also, I wanted to ‘pretend’ I already had existing code that uses a LinkedList. What I want is to get a LinkedList that is actually managed by the service, but that I can access locally just like it was a normal LinkedList. On top of that I want to do some minimal logging, like if .add() is called it writes on the server: “Add called”.

This is not meant for production, just to help me understand how it works!

So far I’ve tried a lot of things. The most promising is that I have created a class that extends LinkedList and implements Remote. This class tries to register itself with the Registry in the constructor like this:


try {

UnicastRemoteObject.exportObject((Remote)this);
Naming.rebind("theList", (Remote)this);
}
catch (Exception e) {
System.out.println("fail");
System.out.println(e.getMessage());
}

I have to do this because I need to extend LinkedList, thus I cannot extend UnicastRemoteObject.

The output I get when I try to run this, on the server side:

fail
Connection refused to host: 192.168.178.27; nested exception is: 
 java.net.ConnectException: Connection refused

And on the client side:

java.lang.ClassCastException: MyList_Stub cannot be cast to java.util.LinkedList
 at $Proxy0.createList(Unknown Source)
 at RemoteProgram.main(RemoteProgram.java:27)

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T15:56:49+00:00Added an answer on May 15, 2026 at 3:56 pm

    What you are trying to do is very inefficient and not a very good idea. Basically you can send anything in a method invocation that you can serialize. If you want good performance, I would suggest that you only have one remote object that represents your service and acts as a facade for all the services that you need (each remote object results in separate file descriptor, so having lots of remote objects is typically not a good idea). Additionally, if you are frequently adding and removing objects, then sending a message every time you add or remove an element is not really sensible. I would suggest having a single remote object with the following two very simple methods:

    LinkedList retrieveLinkedListByName(String);
    boolean commitNewVersionOfLinkedListByName(String,LinkedList);
    

    On application startup, you can download the linked list, and then at regular intervals and at application exit, you can send back the linked list. That should be more efficient then using the network every time you add or remove an element to your linked list. As long as the elements of your LinkedList are serializable, you don’t need to do any magic (like extending remote) for it be sent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can successfully connect to MySQL from a DOS prompt, but when I try
I can successfully include main jquery files in /Scripts, but if my custom test.js
I have successfully created a simple RSS feed, but entries keep coming back as
I have successfully created a asp mvc app which basically has interface, service and
I have successfully created the message queue by using the following command: msgIdHareTurtle =
I Successfully created an user control for displaying Error message. now everything works fine
I have successfully created video from images using the following code -(void)writeImageAsMovie:(NSArray *)array toPath:(NSString*)path
I have successfully created a disabled user in Active Directory via JNDI, but I
I have successfully created a Python Windows service using pywin32. In testing my application
So I'm a newbie to TDD, and I successfully created a nice little sample

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.