Trying to serialize inner class and getting various errors.

Hi, I'm working on a program that contains the inner class User. user implements serializable, and writes just fine. For some strange reason, though, after I read it, I keep getting NullPointerExceptions in my code.
I also tried it using externalization. The User class is essentially built around a HashMap. I have the following methods:
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(mainMap);
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
mainMap = (Map) in.readObject();
String test = (String) in.readObject();
Whenever inputstream.readObject() is called, though, I get an InvalidClassException; "no valid constructor." The sad part is that I have the method:
public User () {
main = new HashMap();
Does anyone know what the problem is??? Thanks a lot!

Does anyone know what the problem is???The inner class is not a static inner class. Therefore your constructor User, is actually User(OuterClass). Solution - make the class static OR use read and/or write resolution to reconstruct the relationship.

Similar Messages

  • Trying to download I tunes and get this error message Service " Apple Mobile Device" ( Apples Mobile Device) failed to start. Verify that you have sufficent privileges to start system services

    Trying to download I tunes and get this error message Service " Apple Mobile Device" ( Apples Mobile Device) failed to start. Verify that you have sufficent privileges to start system services

    See Troubleshooting issues with iTunes for Windows updates.
    tt2

  • I'm trying to download an eBook and getting E_IO_Write error.  Can anyone help?

    I'm trying to download an eBook and getting E_IO_WRITE error.  Does anyone know how to solve this problem?

    I am getting the same error with the Bourne extras

  • Trying to download InDesign CC and getting an error message-

    Trying to download InDesign CC and getting an error message… "Unable to launch Adobe InDesign as you do not have sufficient permissions to access the preferences folders. Ensure that you have appropriate permissions and then restart Adobe InDesign". All other apps that I've downloaded are working properly, but InDesign won't open.
    Here's the screen shot of the error box...

    Hi McMilla,
    as per the screen shot it looks like we dont have enough permissions on your Preference folder . I would suggest the following steps and let us know if these worked or not for you  .
    Go to //Library/Preferences/
            ~/library/Preferences
             /library/application support/Adobe
            ~/Library/application support/Adobe
    and give full permissions to Preferences folder and the Adobe folder.
    Cheers,
    Kartikay Sharma

  • Windows 7 no internet, tried downloading drivers from bootcamp and get an error mssg saying they are no longer on server.  What to do?

    Found many threads but all seem old.  Tried downloading to a thumb drive from boot cafmp but get an error mssg saying that drivers are no longer available.  Any help would be great.

    Update
    Two power cycles later and all working again. Not sure why, but hayho.

  • Trying to download itunes update and getting an error for 10.3.1

    Open iTunes and they said there was an update.  10.3.1  I tried to download it, but once it starts installing, I get an error message stating "errors occured while installing the updates.  if the problem persistes, go to tools and download manually."  So I did that, so it tries to install and now i'm getting that an error has occured with quicktime and iTunes needs quicktime.  I have quicktime on my computer already, should I reinstall it?  I don't know how to fix this.....

    replying to hajar
    I have a similar problem. the error number is 2330.
    That one's consistent with disk/file damage. The first thing I'd try with that is running a disk check (chkdsk) over your C drive.
    XP instructions in the following document: How to perform disk error checking in Windows XP
    Vista instructions in the following document: Check your hard disk for errors
    Windows 7 instructions in the following document: How to use CHKDSK (Check Disk)
    Select both Automatically fix file system errors and Scan for and attempt recovery of bad sectors, or use chkdsk /r (depending on which way you decide to go about doing this). You'll almost certainly have to schedule the chkdsk to run on startup. The scan should take quite a while ... if it quits after a few minutes or seconds, something's interfering with the scan.
    Does the chkdsk find/repair any damage? If so, can you get an install to go through properly afterwards?

  • HT1420 I am trying to deauthorize a computer and get an error message solution?

    I have 1 compter and 4 Apple devices authorized and bought a new computer. I'm trying to deauthorize the old to authorize the new but get an error message.

    What does the error message say? (Precise text, please.)

  • Have Spotfy, Facebook App on home computer, trying to open on laptop and get this ERROR CODE: Firefox doesn't know how to open this address, because the protocol (spotify) isn't associated with any program. How can I fix?

    I have used Spotfy Music App on Facebook on my home computer, now trying to use on laptop, and i get this ERROR CODE: Firefox doesn't know how to open this address, because the protocol (spotify) isn't associated with any program. How can I fix this? Thanks in advance for any help

    Hi,
    You may have to install the Spotify application on the laptop to get Spotify protocols recognized.

  • Was trying to update my ITunes and get this error: The procedure entry point AVCFPlayerItemDurationChangedNotification could not be located in the dynamic link library AVFoundationCF.dll. Just got the new IPhone and am trying to share music files. Can any

    I have Windows Vista computer. I am trying to upgrade my ITunes so can share files with other home computer. (Just got the new IPhone). I get this system error: The procedure entry point AVCFPlayerItemDurationChangedNotification could not be located in the dynamic link library AVFoundationCF.dll. Tries system restore and redownloaded...NOW Itunes will not even open. Can anyone help?

    I uninstalled Apple Application Support, opened iTunesSetup with WinRar, and went down the list of msi's. AppleApplicationSupport was an install, all the others I did Repair.  Did not have to reboot. Works okay now.
    HTH

  • Trying to publish to Flickr and get code error 4, document is empty?

    Does anyone have a solution to the question?

    Suggestions mentioned in this article should help. Error changing modules | Lightroom
    ~ Arpit

  • Private inner class and static private inner

    Hi,
    I understand the concept and usage of inner classes in general.
    When should we go for a private inner class and when for a static private inner class? I tried searching but it wasn't of much help.
    Basically I need to design a caching solution in which I need to timestamp the data object. After timestamping, data will be stored in a HashMap or some other collection. I'm planning to use a wrapper class (which is inner and private) which holds the data object and timestamp. I can make the program work by using either normal inner class or static inner class, however would like to know which is better in such case. Also If I can get some general guidelines as to when to use a staic inner class and when to use a normal inner class, it would help me.
    Thanks in advance.

    user1995721 wrote:
    When should we go for a private inner class and when for a static private inner class?
    I can make the program work by using either normal inner class or static inner class, however would like to know which is better
    If I can get some general guidelines as to when to use a static inner class and when to use a normal inner class, it would help me.Making the inner class static is helpful in that it limits visibility.
    If the inner class needs to access non-static fields or methods from the containing class instance
    the inner class has to be non-static.

  • Trying to install iTunes and get this error: "The installer encountered errors before iTunes could be configured   Errors occurred during installation. Your system has not been modified"

    HELP!!!
    I am trying to install iTunes on my Windows 7 laptop and get this error:
    "The installer encountered errors before iTunes could be configured   Errors occurred during installation. Your system has not been modified"
    Arghhhhh!! I've tried different browsers and various other things suggested on other posts to no avail  

    Ok people, I think I have found the solution !
    If you click on the start button from your desktop screen.
    Then in the "search programs and files" field type : apple software update - you can find the apple installer.
    Click on the apple software update line and let the machine run it's course. I recommend updating whatever it wants to , ie: safari 5, quicktime, itunes....
    I then restarted my computer and it seems to be working now !
    Good luck everyone !

  • I am trying to open my iTunes on a Windows XP laptop and get the error message 42404 "iTunes application could not be opened.  Please repair or reinstall QuickTime".  I did that and it did not help.  Any ideas?

    I am trying to open my iTunes on a Windows XP laptop and get the error message 42404 "iTunes application could not be opened.  Please repair or reinstall QuickTime".  I did that and it did not help.  Any ideas?

    Let's see if a more rigorous uninstall/reinstall procedure gets us past that, nancy. See the following troubleshooting document:
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP

  • I have an iPod Touch version 4.2.1, and whenever iTunes tries to sync my iPod, I get an error message saying "Mobile Backup has encountered a problem and needs to close", and the sync fails.  What can I do to fix this problem?

    I have an iPod Touch version iOS 4.2.1, 8 G capacity, and whenever iTunes tries to sync my iPod, I get an error message saying "Mobile Backup has encountered a problem and needs to close", and the sync fails.  I have tried deleting and reinstalling iTunes, and the same thing happens.  What can I do to fix this problem?

    Try:
    iOS: If you can't back up or restore from a backup in iTunes

  • Macbook pro. app tries to use flash player and get " Blocked plugin" how to uninstall and reinstall flash player. update does nothing ?

    Wife has an older MacBook Pro. when an app uses flash player "Blocked plugin" comes up. I don't know much about mac, tried to update flash player and get newer version already installed, and update and still get same message. How do I uninstall flash player and reinstall?

    Sounds like it is blocked for the website you are at. Check with this:
    You can quickly test whether a recently added plug-in is causing problems by blocking it.
    Choose Safari > Preferences, click Security, then click Website Settings next to Allow Plug-ins.
    Select the plug-in you want to disable on the far left, then click each pop-up menu on the right and choose Block.For some plug-ins, you see pop-up menus for different websites, and you can choose to block each one individually. Use the “When visiting other websites” pop-up menu to block all other websites that don’t have individual settings.

Maybe you are looking for