Pacman "invalid ELF header"

hello,
today i tried to install archlinux on my notebook. I followed the guide provided on the wiki.
I installed the base system and established an internet connection.
Unfortunately my pacman won't work. If i try to start it, the following error appears:
pacman: error while loading shared libraries: /lib/libbz2.so.1.0: invalid ELF header
I have no idea how to fix this. Can you please help me?
Thx geometr

No, i installed the i686. There didn't appear any problems during the whole installation process.
Any further ideas? Or would you suggest to set it up again?
Thx so far.

Similar Messages

  • [SOLVED] Invalid ELF header

    Hi list,
    since two or three system updates I frequently receive 'invalid ELF header ' warnings when using pacman, but they don't really caused errors. Now, trying to install mplayer, I get an error:
    error while loading shared library
    /usr/lib/libsmbclient.so.0: invalid ELF header
    There are some reports in Ubuntu forums about this, but searching the arch forum no yielded results. Whats that all about the ELF headers and how to remedy the problem?
    Cheers
    Last edited by 4on6 (2012-02-15 23:01:15)

    karol wrote:Have you tried resolving the 'file exist in filesystem' issue: https://bbs.archlinux.org/viewtopic.php?id=130138 ?
    Not yet, its quite a lot of work. I'm half through the list, and they are all false alarms it seems.
    (1/1) Prüfe auf Dateikonflikte [################################################] 100%
    Fehler: Konnte den Vorgang nicht durchführen (In Konflikt stehende Dateien)
    smbclient: /usr/bin/net existiert im Dateisystem
    smbclient: /usr/bin/nmblookup existiert im Dateisystem
    smbclient: /usr/bin/rpcclient existiert im Dateisystem
    smbclient: /usr/bin/smbcacls existiert im Dateisystem
    smbclient: /usr/bin/smbclient existiert im Dateisystem
    smbclient: /usr/bin/smbcquotas existiert im Dateisystem
    smbclient: /usr/bin/smbget existiert im Dateisystem
    smbclient: /usr/bin/smbspool existiert im Dateisystem
    smbclient: /usr/bin/smbtar existiert im Dateisystem
    smbclient: /usr/bin/smbtree existiert im Dateisystem
    smbclient: /usr/include/libsmbclient.h existiert im Dateisystem
    smbclient: /usr/include/netapi.h existiert im Dateisystem
    smbclient: /usr/lib/cups/backend/smb existiert im Dateisystem
    smbclient: /usr/lib/libnetapi.so existiert im Dateisystem
    smbclient: /usr/lib/libnetapi.so.0 existiert im Dateisystem
    smbclient: /usr/lib/libsmbclient.so existiert im Dateisystem
    smbclient: /usr/lib/libsmbclient.so.0 existiert im Dateisystem
    smbclient: /usr/lib/libwbclient.so existiert im Dateisystem
    smbclient: /usr/lib/libwbclient.so.0 existiert im Dateisystem
    smbclient: /usr/share/man/man1/nmblookup.1.gz existiert im Dateisystem
    smbclient: /usr/share/man/man1/rpcclient.1.gz existiert im Dateisystem
    smbclient: /usr/share/man/man1/smbcacls.1.gz existiert im Dateisystem
    smbclient: /usr/share/man/man1/smbclient.1.gz existiert im Dateisystem
    smbclient: /usr/share/man/man1/smbcquotas.1.gz existiert im Dateisystem
    smbclient: /usr/share/man/man1/smbget.1.gz existiert im Dateisystem
    smbclient: /usr/share/man/man1/smbtar.1.gz existiert im Dateisystem
    smbclient: /usr/share/man/man1/smbtree.1.gz existiert im Dateisystem
    smbclient: /usr/share/man/man7/libsmbclient.7.gz existiert im Dateisystem
    Fehler sind aufgetreten, keine Pakete wurden aktualisiert.
    [tj@arch ~]$ sudo pacman -Qo /usr/bin/net
    Fehler: Kein Paket besitzt /usr/bin/net
    [tj@arch ~]$ sudo pacman -Qo /usr/bin/nmblookup
    Fehler: Kein Paket besitzt /usr/bin/nmblookup
    [tj@arch ~]$ sudo pacman -Qo /usr/bin/rpcclient
    Fehler: Kein Paket besitzt /usr/bin/rpcclient
    [tj@arch ~]$ sudo pacman -Qo /usr/bin/smbcacls
    Fehler: Kein Paket besitzt /usr/bin/smbcacls
    [tj@arch ~]$ sudo pacman -Qo /usr/bin/smbcquotas
    Fehler: Kein Paket besitzt /usr/bin/smbcquotas
    [tj@arch ~]$ sudo pacman -Qo /usr/bin/smbget
    Fehler: Kein Paket besitzt /usr/bin/smbget
    [tj@arch ~]$ sudo pacman -Qo /usr/bin/smbspool
    Fehler: Kein Paket besitzt /usr/bin/smbspool
    [tj@arch ~]$ sudo pacman -Qo /usr/bin/smbtar
    Fehler: Kein Paket besitzt /usr/bin/smbtar
    [tj@arch ~]$ sudo pacman -Qo /usr/include/libsmbclient.h
    Fehler: Kein Paket besitzt /usr/include/libsmbclient.h
    [tj@arch ~]$ sudo pacman -Qo /usr/include/netapi.h
    Fehler: Kein Paket besitzt /usr/include/netapi.h
    [tj@arch ~]$ sudo pacman -Qo /usr/include/netapi.h

  • Paprefs won't open: libpangomm-1.4.so.1: invalid ELF header [SOLVED]

    I'm trying to open paprefs but I get this error:
    paprefs: error while loading shared libraries: /usr/lib/libpangomm-1.4.so.1: invalid ELF header
    Error appears in xfce and xmonad. Anybody have experience with this?
    Last edited by ibid (2011-12-27 05:07:24)

    karol wrote:Have you tried reinstalling pangomm?
    I get /usr/include/pangomm-1.4/pangomm/* exists in filesystem
    I tried a pacman -Rdc pangomm, but I get the same ...pangomm/*  exists in filesystem errors.
    Now the current version of pangomm is 2.28.4-1, so I must be out of date. I tried temporarily moving the 1.4 files out to get 2.28 to install, but once that happens I get a similar error for cairomm, which is also out of date.
    Now I don't remember seeing anything about these gtk libraries recently, but I think I've got something more serious than a paprefs problem.
    I'll dig around a bit more. This is probably the wrong forum now.

  • [SOLVED] Massive upgrade broke my system (invalid ELF header)

    Hi,
    Today I decided to upgrade my system (last time i upgraded was 1 or 2 months ago), but now I can't login.
    I use gdm and I tried to login in both KDE and Gnome, with the same error:
    /usr/bin/ssh-agent: error while loading shared libraries: /usr/lib/libkafs.so.0: invalid ELF header
    When I was upgrading my system I noticed the following error for the packages 'pango', 'gconf', 'zsh', 'ktorrent':
    /sbin/ldconfig: /usr/lib/libotp.so is not an ELF file - it has the wrong magic bytes at the start
    /sbin/ldconfig: /usr/lib/libkasf.so is not an ELF file - it has the wrong magic bytes at the start
    /sbin/ldconfig: /usr/lib/libmp3lame.so is not an ELF file - it has the wrong magic bytes at the start
    /sbin/ldconfig: /usr/lib/libMrm.so is not an ELF file - it has the wrong magic bytes at the start
    /sbin/ldconfig: /usr/lib/libUil.so is not an ELF file - it has the wrong magic bytes at the start
    /sbin/ldconfig: /usr/lib/libUil.so is not an ELF file - it has the wrong magic bytes at the start
    /sbin/ldconfig: /usr/lib/libQtDesignerComponents.so is not an ELF file - it has the wrong magic bytes at the start
    This error message is also coming when i use pacman.
    Note that I have an another bug (maybe related to this one), I installed 'xsane' and 'libjpeg' (required by xsane), then I ran into lot of troubles: lot of applications didn't start (amarok, pgadmin, xsane...) so I had to ""fix"" this by symlinking libjpeg,62.
    I hope we can solve this mess.
    Tell me if you need more information
    Vincent
    Last edited by zakora (2009-07-20 19:24:41)

    Well, there still a problem, with readline.
    When I'm unable to use pacman nor to start postgres, i've got this error:
    /bin/bash: error while loading shared libraries: libreadline.so.6: cannot open shared object file: No such file or directory
    I alreadey tried to re-install readline, but it did solve the problem.
    Any suggestion?
    Edit:
    ls -l /usr/lib | grep readline
    -rw-r--r--  1 root root   9,1K juil. 19 20:27 libguilereadline-v-17.a
    lrwxrwxrwx  1 root root     31 juil. 19 01:09 libguilereadline-v-17.so -> libguilereadline-v-17.so.17.0.3
    lrwxrwxrwx  1 root root     31 juil. 19 01:09 libguilereadline-v-17.so.17 -> libguilereadline-v-17.so.17.0.3
    -rwxr-xr-x  1 root root    16K juil. 19 20:27 libguilereadline-v-17.so.17.0.3
    -rw-r--r--  1 root root   291K juil. 19 20:27 libreadline.a
    Edit 2:
    In fact readline is not installed, how can i install it without pacman??
    Last edited by zakora (2009-07-19 19:30:02)

  • Xorg fails with "/usr/lib/libexpat.so.1: invalid ELF header"

    After upgrade, Xorg fails with the following message:
    (EE) AIGLX error: dlopen of usr/lib/xorg/modules/dri/i965_dri.so failed (/usr/lib/libexpat.so.1: invalid ELF header)
    (EE) AIGLX: reverting to software rendering
    openbox: error while loading shared libraries: /usr/lib/libexpat.so.1: invalid ELF header
    (I also get en error about fbcon, fbdev modules, but have read that this is not actually an issue.)
    Thanks for any help.
    Last edited by marimo (2010-01-24 07:12:25)

    If it were different architectures, there would be an ELF class error. Assuming that all of the installed libraries are from the Arch repos, I'm betting that expat is corrupt. I would reinstall expat and see if that solves the problem.

  • Invalid ELF Header

    Hi,
    I take error like this,
    06:31:36,755 ERROR Log:23 - could not load native library, host-auth disabled
    java.lang.UnsatisfiedLinkError: /home/hkocyigit/IdeaProjects/sup_omi/libshaj.so: /home/hkocyigit/IdeaProjects/sup_omi/libshaj.so: invalid ELF header
         at java.lang.ClassLoader$NativeLibrary.load(Native Method)
         at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)
         at java.lang.Runtime.loadLibrary0(Runtime.java:822)
         at java.lang.System.loadLibrary(System.java:992)
         at com.cenqua.shaj.Shaj.<clinit>(Shaj.java:47)
    Invalid ELF header why this error becomes.
    thanks for help.

    Maybe the file is damaged or of wrong format.
    What do
    file /home/hkocyigit/IdeaProjects/sup_omi/libshaj.so
    nm /home/hkocyigit/IdeaProjects/sup_omi/libshaj.soyield?

  • [SOLVED] recent kernel-break + invalid ELF headers

    Dear all!
    It seems, that yesterdays "repo-sync glitch" (https://bbs.archlinux.org/viewtopic.php?id=175637) had me, too.
    Unfortunately, I'm not able to use the chrooted pacman! It gives me
    pacman: error while loading shared libraries: /usr/lib/libcurl.so.4: invalid ELF header
    and I'm not able to do anything - e.g. Kernel downgrade.
    I tried the pacman -r /mnt ... method from LIVE but I got stuck with "unable to find root device ..." on reboot :-(.
    What is the proper way to get out of this troubles?
    Thanks,
    Guntram
    Last edited by guntram (2014-01-15 22:15:21)

    Thanks!
    I did so (there were several broken ELF messages) and I'm finally able to reboot my system.
    However, some things still don't work. Gnome-Shell freezes after some short seconds after login...
    I'm getting
    systemd-journald[127]: Failed to write entry (26 items, 660087 bytes) despite vacuuming, ignoring: Argument list too long
    while booting and when going to a terminal session instead of gnome-shell.
    Should I try to reinstall all packages?

  • Invalid ELF Heder [possible solution, for the unlucky]

    well i duno whre to post this, but whatevr..
    [woffle]
    yesterday i found that for whatever reason a lot of apps stop working ,
    and instead started complaining about libc.so..6 having an invalid ELF Header... [?] i dunno, that was before and after the upgrade to the 2.5 version...
    anyay, i googled it and found a few random users with this problem, so i knew it had nothign to do with anything.. prolly just the unlucky ones lol..
    [possible solution]
    anways... i managed to fix it [i think] by linking /usr/lib/libc.so.6 to /lib/libc.so.*2.5 instead of /usr/lib/libc.so
    [add]
    /usr/lib/libc.so is an ld-script btw. duno if it should be that way..
    i'd file a bug report, but as i said.. it just happened out of teh blue, i did no sys up/down-grades , compiles, nothing... apart form install kdebase to get kate...

    Hi Florin,
    Check person type useage also. coz When Employee.Ex-Applicant' person type changes to 'Employee.Applicant', no other actions can be processed for that person.
    Kind Regards,

  • Invalid stream header exception

    hi all
    I have a program to encrypt/decrypt a file using existing secret key
    which is generated by my java code and it works fine. I got a key from a friend and an encrypted file to decrypt it but the program throws this exception:
    java.io.StreamCorruptedException: invalid stream header: 87449FAA
    Exception in thread "main" java.security.InvalidKeyException: No
    installed provider supports this key: (null) this is my code:
    try
        //throws exception here
        ObjectInputStream in = new ObjectInputStream(new
    FileInputStream("key.dat"));
        key = (SecretKey)in.readObject();
        byte[] raw = key.getEncoded();
        skeySpec = new SecretKeySpec(raw, "AES");
        in.close();
    catch (Exception e)
        System.out.println(e);
    Cipher cipher = Cipher.getInstance("AES");
    cipher.init(Cipher.DECRYPT_MODE, skeySpec); Honestly i don't know how my friend creates the secret key but i think he uses some key generation tools. I suppose the key file is not corrupted because he used it to encrypt/decrypt other files.

    Looks like your friend did not use Java serialization to save the key in the file.
    Edited by: sabre150 on Apr 13, 2008 5:27 PM

  • Invalid stream header Exception - AES PBE with SealedObject

    I am trying to do an PBE encryption with AES algorithm and SunJCE provider, using the SealedObject class to encrypt/decrypt the data...
    And Im still getting the "invalid stream header" exception. Ive searched this forum, readed lots of posts, examples etc...
    Here is my code for encryption (i collected it from more classes, so hopefully I didnt forget anything...):
        //assume that INPUT_STREAM is the source of plaintext
        //and OUTPUT_STREAM is the stream to save the ciphertext data to
        char[] pass; //assume initialized password
        SecureRandom r = new SecureRandom();
        byte[] salt = new byte[20];
        r.nextBytes(salt);
        SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
        KeySpec keySpec = new PBEKeySpec(pass, salt, 1536, 128);
        SecretKey pbKey = factory.generateSecret(keySpec);
        SecretKeySpec key = new SecretKeySpec(pbKey.getEncoded(), "AES");
        Cipher ciph = Cipher.getInstance("AES/CTR/NoPadding");
        ciph.init(Cipher.ENCRYPT_MODE, key);
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        int ch;
        while ((ch = INPUT_STREAM.read()) >= 0) {
          byteOut.write(ch);
        SealedObject sealed = new SealedObject(byteOut.toByteArray(), ciph);
        BufferedOutputStream bufOut = new BufferedOutputStream(OUTPUTSTREAM);
        ObjectOutputStream objOut = new ObjectOutputStream(bufOut);   
        objOut.writeObject(sealed);
        objOut.close();
      }And here is my code for decrypting:
        //assume that INPUT_STREAM is the source of ciphertext
        //and OUTPUT_STREAM is the stream to save the plaintext data to
        char[] pass; //assume initialized password
        SecureRandom r = new SecureRandom();
        byte[] salt = new byte[20];
        r.nextBytes(salt);
        SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
        KeySpec keySpec = new PBEKeySpec(pass, salt, 1536, 128);
        SecretKey pbKey = factory.generateSecret(keySpec);
        SecretKeySpec key = new SecretKeySpec(pbKey.getEncoded(), "AES");
        BufferedInputStream bufIn = new BufferedInputStream(INPUT_STREAM);    //MARK #1
        ObjectInputStream objIn = new ObjectInputStream(bufIn);   
        SealedObject sealed = (SealedObject) objIn.readObject();   
        byte[] unsealed = (byte[]) sealed.getObject(key);          //MARK #2
        ByteArrayInputStream byteIn = new ByteArrayInputStream(unsealed);
        int ch;
        while ((ch = byteIn.read()) >= 0) {
          OUTPUT_STREAM.write(ch);
        OUTPUT_STREAM.close();Everytime I run it, it gives me this exception:
    Exception in thread "main" java.io.StreamCorruptedException: invalid stream header: B559ADBE
         at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)
         at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
         at javax.crypto.SunJCE_i.<init>(DashoA13*..)
         at javax.crypto.SealedObject.unseal(DashoA13*..)
         at javax.crypto.SealedObject.getObject(DashoA13*..)
         at oopsifrovanie.engine.ItemToCrypt.decrypt(ItemToCrypt.java:91)  //MARKED AS #2
         at oopsifrovanie.Main.main(Main.java:37)    //The class with all code below MARK #1I've also found out that the hashCode of the generated "key" object in the decrypting routine is not the same as the hashCode of the "key" object in the ecrypting routine. Can this be a problem? I assume that maybe yes... but don't know what to do...
    When I delete the r.nextBytes(salt); from both routines, the hashCodes are the same, but that's not the thing I want to do...
    I think, that the source of problem can be this part of code (generating the key):
        SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
        KeySpec keySpec = new PBEKeySpec(pass, salt, 1536, 128);
        SecretKey pbKey = factory.generateSecret(keySpec);
        SecretKeySpec key = new SecretKeySpec(pbKey.getEncoded(), "AES");But I derived it from posts like: [http://forums.sun.com/thread.jspa?threadID=5307763] and [http://stackoverflow.com/questions/992019/java-256bit-aes-encryption] and they claimed it's working there...
    Is there anyone that can help me?
    Btw, I don't want to use any other providers like Bouncycastle etc. and I want to use PBE with AES and also SealedObject to store the parameters of encryption...

    Yes, it really uses only one Cipher object, but it does decoding in a little nonstandard (not often used) way, by using the SealedObject class and its getObject(Key key) method. You can check these links for documentation: [http://java.sun.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html#SealedObject] and [http://java.sun.com/javase/6/docs/api/javax/crypto/SealedObject.html] So the question is, why it doesn't work also with the AES routines, because it should.
    Btw, according to [http://java.sun.com/javase/6/docs/technotes/guides/security/SunProviders.html#SunJCEProvider] PBEWithSHA1AndDESede/CBC/PKCS5Padding is a valid JCE algorithm for the Cipher class.
    Firstly, I was generating the key for AES enc./decryption this way and it was working:
    char[] pass; //assume initialized password
    byte[] bpass = new byte[pass.length];
        for (int i = 0; i < pass.length; i++) {
          bpass[i] = (byte) pass;
    SecretKeySpec key = new SecretKeySpec(bpass, "AES");
    But I think, that it really wasn't secure, so I wanted to build a key from the password using the PBE.
    Maybe there's also a way how to do this part of my AES PBE algorithm: *KeySpec keySpec = new PBEKeySpec(pass, salt, 1536, 128);* manually (with my own algorithm), but I dont know how to do it and I'd like it to be really secure.
    Btw, thanks for your will to help.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • LWAPP"invalid IP header checksum"

    Hello , i hace a problem with a wireless network based on 4 WiSM (two in two 6500) and AP1010. AP's get IP from the DHCP and associate to the controller, but after a while, they start sending a syslog message LWAPP-ERROR: "invalid IP header checksum". I have ping losses and the AP dissasociates, reloads and reassociates to the controller. Does anyone have found the same problem?
    thanks

    What code are you running on the WLC's? I know that with the AP1010, you can't be running the newer code. that is why I ask.
    Is this happening on all 4 WLC's and can you post a snip of the log from the cli.

  • Problem: Invalid BTree Header

    I don't use 9.2.2 much but could it be a problem for 10.4.7? on 9.2.2 I get: Problem: Invalid BTree Header all the time after running Disk first aid again and again. It says it fixed the problem but the error keeps comming back.
    I know this has been disscussed elsewhere but I could not find a definite answer on what to do. I will not use Norton. Please help.
    W.W.

    Hi Walter;
    If DW can touch the problem, about the only solution left is to reformat and reinstall now.
    One question, you did run DW while booted from another disk? If not, DW is not able to repair the disk that the operating system is running from.
    Allan

  • Getting "java.io.StreamCorruptedException: invalid stream header"

    When creating a self made Stream (MacInputStream) and then using an ObjectInputStream over it to read Objects from a socket, I get this error:
    java.io.StreamCorruptedException: invalid stream header
         at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:764)
         at java.io.ObjectInputStream.<init>(ObjectInputStream.java:277)
         at TServidor.run(TServidor.java:32)
    Is there any special feature that the "self-made" streams have to implement to be possible to use ObjectInput streams over them :P ?
    Here is the MacInputStream.java code:
    import java.io.Closeable;
    import java.io.FilterInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.Arrays;
    import javax.crypto.Mac;
    public class MacInputStream extends FilterInputStream implements Closeable{
         private Mac mac; // algorithm
         private byte [] mmac; //message MAC
         private boolean FIRST_TIME;
         public MacInputStream(InputStream is,Mac mac) {
              super(is);
              this.mac=mac;
              FIRST_TIME=true;
    public int read() throws IOException{
              if(FIRST_TIME){
                   mmac = new byte [mac.getMacLength()];
                   super.read(mmac);
              if(super.in.available()==0){
                   FIRST_TIME=true;
                   return -1;
              int rbyte = super.in.read();
              FIRST_TIME=false;
              mac.update((byte)rbyte);
              System.out.println("available: "+super.in.available());          
              if(super.in.available()==0){
                   byte [] macres =mac.doFinal();
                   System.out.println("message MAC: "+new String(mmac));
                   System.out.println("calculated MAC: "+new String(macres));
                   if(!Arrays.equals(macres, mmac)){
                        throw new IOException("violated integrity");
              return rbyte;
    public int read(byte [] b) throws IOException{
         if(FIRST_TIME){
              mmac = new byte [mac.getMacLength()];
              super.in.read(mmac);          
         if(super.available()==0){
              FIRST_TIME=true;
              return -1;
         int rbytes = super.in.read(b);
         FIRST_TIME=false;
         mac.update(b);
         if(super.available()==0){
              byte [] macres =mac.doFinal();
              if(!Arrays.equals(macres, mmac)){
                   throw new IOException("violated integrity");
         return rbytes;
    }And here is the "main" function where the exception gets thrown:
    public void run() {
         try {
              ObjectOutputStream oos = new ObjectOutputStream(s.getOutputStream());
              Mac mac = Mac.getInstance("HmacMD5");
              Key key = KeyGenerator.getInstance("HmacMD5").generateKey();          
              oos.writeObject(key);
              oos.flush();
              mac.init(key);          
              ObjectInputStream cis = new ObjectInputStream(new MacInputStream(s.getInputStream(),mac));
             String test;
             try {
                   while (true) {
                        test = (String)cis.readObject();
                        System.out.println(ct + " : " + test);
              } catch (EOFException e) {
                   System.out.println("["+ct + "]");
              } finally {
              if (cis!=null) cis.close();
              if (oos!=null) oos.close();
         } catch (Exception e) {
             e.printStackTrace();
        }It's exactly in the line: ObjectInputStream cis = new ObjectInputStream(new MacInputStream(s.getInputStream(),mac));Any ideas?
    I'm starting to desperate :P

    (a) I still don't see where you are writing the MAC that you're reading. You're reading something, but it's all or part of the Object stream header I described above, which is why ObjectInputStream' constructor is throwing that exception.
    (b) You don't need to override read(byte[] b) when you extend FilterInputStream, but you do need to override read(byte[] b, int offset, int length), and you need to do it like this:
    public int read(byte[] buffer, int offset, int length) throws IOException
      int count = 0;
      do
        int c = read();
        if (c < 0)
            break;
        buffer[offset+count++] = (byte)c;
      } while (count < length && available() > 0);
      return count > 0 ? count : -1;
    }This way the read() method gets to see every byte that's read and to do its MAC thing or whatever it does. The above is one of only two correct uses of available() in existence: it ensures that you only block once while reading, which is the correct behaviour e.g. on a network.

  • Java.io.StreamCorruptedException: invalid stream header

    I am having a problem with sending two objects (over a socket). I have read in other posts that this could be due to trying to receive incompatible data types but my applications work fine if I send my objects synchronously rather than asynchronously.
    I will try my best to describe what my problem is as my code is very long.
    I have a server and a client application (2 apps). Multiple clients connect to the server and send their details (as an object) to the server. The server then amends the object (adds some more data) and sends it back to the clients. Both the SendObject and ReceiveObject class are threads and I have created a Listener (within the client) that activates when an object is received (asynchronous communication). The Listener method looks to see if the event is an instance of a particular class and casts is as appropriate (as per below).
    public void receivedObject(ReceivedObjectEvent e) {
         ReceiveObjectThread obj = (ReceiveObjectThread) e.getObject();
         if(obj.getObject() instanceof Player) {
              thePlayer = (Player) obj.getObject();
              theTable.setHandData(thePlayer.getHand());
         if(obj.getObject() instanceof GameData) {
              gameData = (GameData) obj.getObject();
              theTable.setPlayerList(gameData.getOpponents());
    }The objects that are passed between applications both implement Serializable.
    This all works fine synchronously object passing. However, if I try and spawn two sendObject threads within the server and the corresponding two receive threads within the client and wait for the Listener to activate (asynchronously) I get the following error:
    java.io.StreamCorruptedException: invalid stream header: 00057372
         at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)
         at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
         at ReceiveObjectThread.run(ReceiveObjectThread.java:84)
    java.io.StreamCorruptedException: invalid stream header: ACED0006
         at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)
         at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
         at ReceiveObjectThread.run(ReceiveObjectThread.java:84)
    I am sure that this problem is due to my limited knowledge on socket and data transfer. Therefore any help on this one will be gratefully received.

    Hello ejp, your reply is very much appreciated.
    If I explain how I have implemented my sockets you may be able to see where I wrong.
    When a player connects, the client sends the server a �player� object. The server receives the �player� object and passes the socket from which it connected (within the server) to a socket property within the �player� class. Whenever the server needs to send an object to that client (player), it sends the output stream from the socket property within that �player� object. ( player.getSocket().getOutputStream() ).
    Below is the code from the �SendObjectThread� class.
    * This class allows an object to be passed over a Socket
    * @author Harold Clements
    * @version 1.0.1 12-Jun-2007 (12-Jul-2007)
    //http://www.seasite.niu.edu/cs580java/Object_Serialization.html
    public class SendObjectThread extends Thread {
         private OutputStream out;
         private Object obj;
          * This constructor allows the user to passes the two parameters for transmitting.
          * @param out The data stream that the object is going to be sent to.
          * @param obj The object to be sent.
         public SendObjectThread(OutputStream out, Object obj) {
              this.out = out;
              this.obj = obj;
          * The main thread
         public void run() {
              try {
                   ObjectOutputStream objOut = new ObjectOutputStream(out);
                   objOut.writeObject(obj);
                   objOut.flush();
              } catch (IOException e) {
                   e.printStackTrace();
    }The client only has one socket which is defined when the client first makes a connection with the server. The �getOutputStream()� and �getInputStream()� are used for all communication from the client.
    Is this what you described in your first option?
    The funny thing about it all is if I create a new �receiveObjectTread� and wait for that to finish, then create another �receiveObjectTread� both objects in question (Player and GameData) are received correctly and the application works. I only have the problem when I set both threads off and leave it for the �ReceivedObjectEvent� listener to pick them up and cast them (as per my first post).
    Thanks again for your help,
    Harold Clements

  • Java.util.zip.ZipException: invalid END header

    I get this error when I run the code:
    try {
    jFile = new JarFile(jarBuildFile.getAbsolutePath());
    } catch (IOException ex) {
    System.out.println("Got exception: "+ex);
    but only on very large jar files - about 2.5GB in size.
    With JDK 1.4, I get the error, jar file too large.
    With JDK 1.5, I get the above error (invalid END header).
    With JDK 1.6, it reads the file for about 5 seconds, then reports that the file cannot be opened.
    Smaller jar files work fine. This jar file has two files in it, a small XML file and a large video file.
    I'm running under windows XP.
    Doing a jar -tvf (jdk 1.5) on the large jar file works fine.
    The file was built with the jar command (jdk 1.5).
    Is this a bug in the JDK?
    Thank you!
    -Joe
    http://www.lovehorsepower.com

    Sp0ttedD0g wrote:
    I ran into this problem today too and found out it was due to the fact that I had a jar in my war that I was trying to deploy that had a file format of unicode instead of binary (it had been checked into source control system incorrectly). After updating the jar with the proper format (binary), the problem went away.The other reported problems are due to file size, not content.

Maybe you are looking for

  • P35 Neo doenst start

    I'vd just bought a new mainboard and CPU, which are: - mainboard MSI P35 Neo - Intel Core Quad Q6600 and started building up a new system with my old components: - ATI HD 3870 graphic - 2 GB RAM DDR2 533 - 250GB Hardisk Everything was in its place, b

  • Camera Raw 8.2 in PS CS6 doesn't recognise new lens & camera profiles

    I recently upgraded from PS CS5 to PS CS6 and have run the latest software updates for OSX 10.7.5 (ie PS CS6 13.05 and ACR 8.2.0.94).  My old Canon 7D profiles are still available but, strangely, the camera and lens profiles I expected to see for the

  • Album Art - Not showing all in Album View or Cover Flow

    Recently I redid my Itunes Libary where with one artist with songs from several different albums, (and album artwork), renamed the album under Get Info to "Greatest Hits". Now, the specific album art for each song shows when the song is playing, but

  • What does a broken battery icon on an iPhone used as an iTouch mean?

    I have an old iPhone 3G that is set up as an iTouch for my son to use.  It is not jailbroken, and was set up per the guidelines on Apple support.  It's been working fine for about 6 months.  Now when I charge the device, upon charging, an icon showin

  • Is general account user really needed?

    Hi. Is there really a must to creat a general user account? Or the default account with password is enough? 90% of my software comes from Mac App Store, expect Steam, Perian, Flash and Nikon Capture NX 2. I download all of them from their official si