RMI - Serializing Object with the right constructor..?

Hello, I am trying to usr RMI to send an object that I serialized but I have further porblems than that. The Object that I am using is called FileLineReader and it Extends Buffered Reader. SInce Buffered Reader is not Serializable, I implemented Serializable within FileLineReader, so that I can send it through the RMI.
package musr.client.dbreader;
import java.io.*;
public class FileLineReader extends BufferedReader
          implements LineReader, java.io.Serializable {
String pattern; // The string we are going to be matching.
* Constructor
* Passes the stream to our superclass
public FileLineReader(Reader in) { super(in); }
* This is the filter: call our superclass's readLine() to get the
* actual lines, but only return lines that contain the pattern.
* When the superclass readLine() returns null (EOF), we return null.
public String matchLine(String pattern) throws IOException {
String line;
do { line = super.readLine(); }
while ((line != null) && line.indexOf(pattern) == -1);
return line;
When I use this object to send it through RMI to the Server,
(FileLineReader)inFile = (FileLineReader) obj.senddbFile(openFileTextField1.getText(),openFileTextField2.getText());
I get an exception:
GUI_RMI exception, error unmarshalling return; nested exception is: java.io.InvalidClassException: musr.client.dbreader.FileLineReader; no valid constructor.
I am not sure what the problem is and I have been struggling with it for a while now. The constructor of BufferedReader takes one argument in so I have to pass FileLineReader an argument when I construct it. I think the RMI needs a constructor that takes no arguments and that causes problems. Is that true? In that case, I can't extend my class with BufferedReader.
Or maybe the problem is somthing quite different. Anyone has any suggestions or comments, I'd appreciate help. Thanks Ivan

You will have to create your own stream. (RMI is just a way to call reemote methods; it knows nothing about files or I/O.)
1. You need a RemoteReader. This object should probably have 3 or so methods:
Open(filename) Opens the file
read reads a block from the file and returns it as a byte array.
close()
2. You need a RemoteInputStream object.
o Instantiated on the client.
o Makes calls to the RemoteReader.
o Has some read methods and a close method.
o Implements InputStream.
With these two objects, you have enough underpinnings top - for example - wrap the RemoteINputStream in a BufferedReader or whatever you need.

Similar Messages

  • Serializing objects with the NIO API

    I try to use the new IO API to implement a non-blocking multi-threaded server that communicates with client applications by exchanging serialized objects. I started from the code in the JavaWorld article at http://www.javaworld.com/javaworld/jw-09-2001/jw-0907-merlin.html .
    With the new features of J2SDK 1.4.0, you don't have to create a separate thread per connected client. That is a big improvement.
    But when I read an object with ObjectInputStream, I get a java.nio.channels.IllegalBlockingModeException.
    Has anybody successfully implemented such a server since the release of the new io API?
    Thanks.
    Jean-Robert

    The ObjectStream code is basically incompatible with non blockin I/O since you must block on the stream until a whole Object is available. You could roll something like this yourself, by reading bytes until there are enough available to build the next object and then getting that Object from the buffer and shipping it to your client thread. All of this is far more trouble than just using the Stream oriented I/O.
    NIO and mutilple threads are a nightmare, the whole idea of non-blocking I/O is to avoid needing multiple threads. If you do use multiple threads you will need queues between them. See the Taming the NIO Circus topic for lots of discussion of NIO and its problems. The system seems more stable in JDK 1.5, but most people haven't even started using 1.4 for production yet.
    Personally I avoid ObjectStreams. They are only useful between Java applications, if I want that I just use RMI and let Java do ALL the hard work. When I write a Socket based app, its probably because the other end is a mainframe of a C program. For that reason I send data as bytes, packaged up in packets, and encode as XML or ASN.1 so the other end can interpret it.

  • I have an iPhone 4 on IOS5. I signed up for itunes match. After everything uploaded to the cloud, my songs are messed up. I'll select a song and the title will show with the right art work but a different song will start playing.  Anyone have a solution?

    I have an iPhone 4 on IOS5. I signed up for itunes match. After everything uploaded to the cloud, my songs are messed up. I'll select a song and the title will show with the right art work but a different song will start playing.  Some songs won't play at all even though they do appear in the itunes store. The artwork almost always shows u blank until you turn it to landscape then it will appear. Anyone know what's going on?

    I have found that scrolling through the album list (past albums without art) triggers the progress wheel next to the wifi symbol. You can scroll quickly through the whole collection and then wait! Artwork will appear gradually...
    However, repeat visits to the Music App might initially show no artwork again, but it might spontaneously appear more quickly this time. The bad news is that the whole Music App is now sluggish as ****...

  • [SOLVED] Thunar 1.6 doesn't drag-and-drop with the right mouse button

    Hallo all.
    It might be something I've done (though I did delete my ~/.config/Thunar directory before upgrading), but Thunar doesn't let me drag-and-drop with the right mouse button, thus stopping me from copying something instead of moving it, etc. Has anyone else had that too?
    Last edited by GordonGR (2012-12-28 14:34:20)

    Joel wrote:
    anonymous_user wrote:Is it supposed to be with the right-mouse button? I always thought drag and drop was done with the left button?
    Could be right-hand user
    Come on! Read what GordonGR wrote!
    Microsoft Windows, Nautilus, the Haiku Tracker, and probably many other file managers have a feature where, when you right-click or middle-click and drag an icon to a new location, a pop-up menu appears and asks what you'd like to do (Move, Copy, Link). I thought I used to use this feature in Thunar too but it seems to have stopped working in recent versions. Has anyone else had any experience with it?
    EDIT: Here's random blogger talking about the feature in an older version of Thunar: http://jeromeg.blog.free.fr/index.php?p … and-tricks So that's good, I wasn't just imagining the feature.
    Last edited by drcouzelis (2012-12-12 03:45:05)

  • RE: multiple named objects with the same name andinterface

    David,
    First I will start by saying that this can be done by using named anchored
    objects and registering them yourself in the name service. There is
    documentation on how to do this. And by default you will get most of the
    behavior you desire. When you do a lookup in the name service (BindObject
    method) it will first look in the local partition and see if there is a
    local copy and give you that copy. By anchoring the object and manually
    registering it in the name service you are programmatically creating your
    own SO without defining it as such in the development environment. BTW in
    response to your item number 1. This should be the case there as well. If
    your "mobile" object is in the same partition where the service object he is
    calling resides, you should get a handle to the local instance of the
    service object.
    Here is the catch, if you make a bind object call and there is no local copy
    you will get a handle to a remote copy but you can not be sure which one!
    It end ups as more or less a random selection. Off the top of my head and
    without going to the doc, I am pretty sure that when you register an
    anchored object you can not limit it's visibility to "User".
    Sean
    -----Original Message-----
    From: [email protected]
    [<a href="mailto:[email protected]">mailto:[email protected]]On</a> Behalf Of David Foote
    Sent: Monday, June 22, 1998 4:51 PM
    To: [email protected]
    Subject: multiple named objects with the same name and interface
    All,
    More than once, I have wished that Forte allowed you to place named
    objects with the same name in more than one partition. There are two
    situations in which this seems desirable:
    1) Objects that are not distributed, but are mobile (passed by value to
    remote objects), cannot safely reference a Service Object unless it has
    environment visibility, but this forces the overhead of a remote method
    call when it might not otherwise be necessary. If it were possible to
    place a copy of the same Service Object (with user visibility) in each
    partition, the overhead of a remote method call could be avoided. This
    would only be useful for a service object whose state could be safely
    replicated.
    2) My second scenario also involves mobile objects referencing a Service
    Object, but this time I would like the behavior of the called Service
    Object to differ with the partition from which it is called.
    This could be accomplished by placing Service Objects with the same name
    and the same interface in each partition, but varying the implementation
    with the partition.
    Does anyone have any thoughts about why this would be a good thing or a
    bad thing?
    David N. Foote
    Consultant
    Get Your Private, Free Email at <a href=
    "http://www.hotmail.com">http://www.hotmail.com</a>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:<a href=
    "http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:<a href=
    "http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>

    David,
    First I will start by saying that this can be done by using named anchored
    objects and registering them yourself in the name service. There is
    documentation on how to do this. And by default you will get most of the
    behavior you desire. When you do a lookup in the name service (BindObject
    method) it will first look in the local partition and see if there is a
    local copy and give you that copy. By anchoring the object and manually
    registering it in the name service you are programmatically creating your
    own SO without defining it as such in the development environment. BTW in
    response to your item number 1. This should be the case there as well. If
    your "mobile" object is in the same partition where the service object he is
    calling resides, you should get a handle to the local instance of the
    service object.
    Here is the catch, if you make a bind object call and there is no local copy
    you will get a handle to a remote copy but you can not be sure which one!
    It end ups as more or less a random selection. Off the top of my head and
    without going to the doc, I am pretty sure that when you register an
    anchored object you can not limit it's visibility to "User".
    Sean
    -----Original Message-----
    From: [email protected]
    [<a href="mailto:[email protected]">mailto:[email protected]]On</a> Behalf Of David Foote
    Sent: Monday, June 22, 1998 4:51 PM
    To: [email protected]
    Subject: multiple named objects with the same name and interface
    All,
    More than once, I have wished that Forte allowed you to place named
    objects with the same name in more than one partition. There are two
    situations in which this seems desirable:
    1) Objects that are not distributed, but are mobile (passed by value to
    remote objects), cannot safely reference a Service Object unless it has
    environment visibility, but this forces the overhead of a remote method
    call when it might not otherwise be necessary. If it were possible to
    place a copy of the same Service Object (with user visibility) in each
    partition, the overhead of a remote method call could be avoided. This
    would only be useful for a service object whose state could be safely
    replicated.
    2) My second scenario also involves mobile objects referencing a Service
    Object, but this time I would like the behavior of the called Service
    Object to differ with the partition from which it is called.
    This could be accomplished by placing Service Objects with the same name
    and the same interface in each partition, but varying the implementation
    with the partition.
    Does anyone have any thoughts about why this would be a good thing or a
    bad thing?
    David N. Foote
    Consultant
    Get Your Private, Free Email at <a href=
    "http://www.hotmail.com">http://www.hotmail.com</a>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:<a href=
    "http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:<a href=
    "http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>

  • Problems moving  an object with the selection tool

    Im working on CS2 and since last week I have a problem moving objects with the selection tool: To move the object I am obligate to select the object first, and then click at the edge/stroke of the object to drag it. Before that I could move the objects just by selecting somewhere in the object and then just drag it to some other place in one step. I think I maybe changed something in the general preferences....

    Ho thanks a lot Kurt!!!!! Indeed, that was the problem!!! Finally I can work normally again.... (the joker was me...but not on purpose)
    Thanks again!

  • Has photoshop started using EXIF orientation to display photos with the right rotation?

    Has photoshop updated recently and started using EXIF orientation to display photographs with the right rotation?
    I thought in the past it ignored the EXIF orientation, but it seems like it is now using it. Does anyone know if you can tell it not to use this information when displaying the image on the screen?
    Please help!!

    Duh! My apologize for not providing the important details.
    The system model I have tested on:
    Mac Pro Early 2009
    2.66Ghz 10GB Memory
    Dual NVIDIA GeForce GT 120 512MB Cards (original cards)
    Tested on 10.7.4-10.7.5, 10.8.2
    Crash Report can be located here:
    http://pastebin.com/aeZ2kYvw  (this was using version 10.7.4)
    It's just odd since last year we've been using this setup fine with v13.0 and now with v.13.0.3 it doesn't work. The reason for our two independent video cards is so that one card sends video to the monitor screen of the teacher, the second card sends a video signal that can be switched to either a projector or 8 lcd monitors in the lab (we've invested a lot of video infrastructure for this lab). When we tested using a single card for both outputs we would get an odd interlace horizontal thin bar that would go top to bottom ever so slowly. This would appear either when looking at video or when moving windows around. Doing the dual video cards solved that issue for us and have been using the setup since 2009.

  • BI Platform: Parameter object with the name "URL_PARAM"... does not exist

    Hi,
    I'm facing this issue with only one dashboard in BI4 Platform. When trying to view it through the BI Launch Pad, I get the following error:
    "Parameter object with the name "URL_PARAM" and the index "0" still does not exist in the parameter 1[...]".
    I've seen this thread where a similar thing was reported with NetWeaver platform.
    My client as well as server versions are Release 1.4 SP0 Patch2 (14.0.5).
    Also, although some of the pictures referenced in the dashboard are not in the Public Folders on BI4. Could it be that it's not able to reference the images and hence not be displaying the whole dashboard?
    Please let me know if anyone has a solution to this.
    Thanks!
    - Sakshi Dhakad

    Hi,
    So here are the versions we currently have:
    SAP BO Design Studio (64 bit) - 14.1.0
    SAP BO Design Studio 1.4 for BI Platform - 14.1.0.349
    And on checking on Central Management Console, I get this:
    SAP BO BI Platform 4.1 Support Pack 5 Patch 2
    Version: 14.1.5.1568
    Also, I'm not sure if I installed an add-on or the patch. Based on these versions, could you tell me how to fix the issue ?
    Thanks!

  • Tom Tom app that was purchased now showing up to buy. Deleted the App as requested before reinstalling it for the update and now the Apps Store says I have to purchase it again. Ive tried resetting the phone. Ive ensured Im signed in with the right userID

    Hey all, Ive tried my best to find a solution to my problem so hopefully someone can help.
    When my Tom Tom Sat Nav app said I should delete the App before reinstalling the App but when I tried too the App was showing up as not purchased and had the price. Ive tried turning the phone on and off. Resetting the Phone. Ensuing that I am signed in with the right User ID. Ive tried changing the location back to the one I purchased the App from as well. Now Im really sure what to do. Any help would be much appreciated.

    No it does not show their either.
    Just to be sure how do I know iClouds os on?
    Thank you so much for this help.

  • I have a school license but i can't upgrade to full versions of my apps. I'm logged in with the right account and on my profile i can see the license is activated.

    i have a school license but i can't upgrade to full versions of my apps. I'm logged in with the right account and on my profile i can see the license is activated.

    This is an open forum, not Adobe support... you need Adobe staff to help
    Adobe contact information - http://helpx.adobe.com/contact.html
    -Select your product and what you need help with
    -Click on the blue box "Still need help? Contact us"

  • When I set up my email address on my new IPad, I keyed it in worng.  How do I correct with the right email address

    When I keyed in my email address on my new IPad, I keyed it in wrong.  How can I correct it with the right email address?

    Start from scratch again with the correct Apple ID (email address)
    Settings>General>Reset>Erase all content and settings

  • Problem with the right and left Channel

    Hey Guys,
    i bought a few days ago the X-Fi Titanium PCIe Card. Now my problem:?
    After i installed the drivers i noticed that i can hear the sounds of the left speaker also in the right speaker of my Headphone (Sennheiser PC60). I made a channel test and here the same. The guy sais "Left Channel" and i hear it on both speakers. The same with the right channel.
    I made a clean restart and uninstalled all Drivers and Applications and reinstalled them: -> Same problem
    I made a clean Windows installation (Vista x64): -> Same problem
    i tried the Daniel_K-Driver: -> Same problem
    Have someone an idea to solve that problem?
    greets
    kybo

    When Soundbooth was first developed, it had a few extra things than what were not available in Audition. However, Audition remained the more high end sound editing tool. Soundbooth was locked to a multiple channel editing approach. In Audition, single editing is easy - you simply click the L or R at the right end of the sound channel to lock it and then you can edit the other channel only.
    Soundbooth has been discontinued and Audition now has taken its place from CS6 to the Creative Cloud.
    The above is some background info. To your current situation, you can use a workaround like:
    * Export your audio file to separate channels by File > Export > Channels to mono files.
    You will get 2 files with _L and _R suffix.
    You can then edit them separately. You can go from Mono to Stereo by the following step.
    Or
    * Choose - Edit > Insert > Channels  into New Multitrack file.
    That will separate the Left and Right Channels and add them to a new multitrack file.
    You can then click the Edit link at the top right of the channel to edit it.
    You can then save that file as a new audio file.
    Dean

  • For another program (WASY WGeo) after the working with PS CC I need a picture with the right colours in the end with 256 colours in 8 bit per picture - I still got it until yesterday. I don´t know what I´ve done wrong in PS CC but I´m still working in mod

    For another program (WASY WGeo) after the working with PS CC I need a picture with the right colours in the end with 256 colours in 8 bit per picture - I still got it until yesterday. I don´t know what I´ve done wrong in PS CC but I´m still working in mode with 8 bit RYB. I controlled my result with Irfan View: it´s a picture with 16,7 million colours and 56 bit pp.

    Topic or subject titles should be clear, pertinent and concise so that individual users can tell at a glance if they can help or not.
    That field is not for attempting to fit your entire question in there.
    Please keep this in mind next time you post.  Thank you.

  • I BOUGHT LIGHTROOM 5 IN LAREDO TX AND I TRIED TO GET IN MONTERREY MEXICO THE SERIAL NUMBER WITH THE REDEMPTION CODE BUT APPEARS AN ERROR. MY PC IS WINDOWS 8. COULD SOMEBODY HELP ME?

    I BOUGHT LIGHTROOM 5 IN BEST BUY LAREDO TX AND I TRIED TO GET IN MONTERREY MEXICO THE SERIAL NUMER WITH THE REDEMPTION CODE FROM THE BOX, BUT APPEARS AN ERROR. MY PC IS WINDOWS 8, COULD SOMEBODY HELP ME??

    I don't know that you can purchase Adobe software in the US for installing and using outside of the US.
    Redemption Code Help
    http://helpx.adobe.com/x-productkb/global/redemption-code-help.html
    Serial number and activation chat support (non-CC)
    http://helpx.adobe.com/x-productkb/global/service1.html ( http://adobe.ly/1aYjbSC )

  • Iphoto causes half my screen to be reversed (screen split with the right side half now on the left side) and computer freezes. Any suggestions about a fix?

    iphoto causes half my screen to be reversed (screen split with the right side half now on the left side and the left hand side on the right.) and screen gets multiple blurry copies. Also the computer freezes. Any suggestions about a fix? Can I delete iphoto and reinstall? If so, will I lose my photos?

    Please post a screenshot that shows what you mean. Be careful not to include any private information.
    Start a reply to this message. Click the camera icon in the toolbar of the editing window and select the image file to upload it. You can also include text in the reply.

Maybe you are looking for

  • Nvidia DVD Problems

    Nvidia and MacrovisionDoes anyone having problems with DVD players on Nforce systems and vga drivers above 40.72(Geforce 2 mx integrated)? When I play a dvd movie with Power DVD 5.0,a small window pops up alerting me that the movie can't run because

  • Change center of multiple clips in one operation

    Say I have 10 JPG files each as 10 second clips. I drag them to the timeline, I select all of them. I now want to move all of them into the top left quadrant of my canvas. I can't see how to do it given that motion seems to be set on a clip by clip b

  • Insurance, subtransactions for posting to account

    I'm trying to automactically use a different subtransaction for posting to account in SAP FS-CD (insurance collections and disbursements). Standard it uses main transaction 5060 and sub 0100. I want it to use maintransaction 5060 and sub 0200 for a s

  • HT2305 how do i get administrator priveleges for the folder i need to install itunes..

    I have tried for 2 entire days of my weekend now - to simply REINSTALL i tunes....I am the admin on the user acct....admin on the browser im using...disables Norton totally....WHAT AM I DOING WRONG?? i AM NOT AN IDIOT WHEN I COMES TO COMPUTER ISSUES.

  • XW_control.xml

    When trying to play crossword on USA Today I get xw_control.xml is missing.  I have tried uninstalling and re-installing it and it doesn't matter.  Tried on google chrome and IE9 and same thing..how do I fix this