3 Replies Latest reply on Jul 23, 2001 12:46 PM by 807596

    Bad magic number

      Hi all

      I am trying to hit an applet through an iplanet web connector.

      The scenario is machine 1 is the web server (iplanet 4.1) . machine 2 is app
      server (iplanet 6.0 sp2)
      The web connector is configured for handling all the requests to machine2
      that refer to the app server.

      when i place my jar (containing the applet classes) on the app server and
      then try to open it through a jsp on the app server itself , it
      throws a

      java.lang.ClassFormatError: com/niit/cliks/te/web/TestingEngine (Bad magic


      But if i try with the same jar file on the web server (the same as running
      the app server( - i.e. machine 2 ) the jar works just fine.

      can anybody put some light on the issue. I am in a very tight deadline

      thanks and regards


      PS - the applet is not signed and i don't wish (and plan) to sign it.

      ==== I have posted this same question to two more forums on sun. Its because i want to attract maximum attention towards the problem...
        • 1. Re: Bad magic number
          A "Bad Magic Number" is an indication that the class file of the applet is corrupted in one way or another. Or in a more extreme case, the JVM may be corrupt.

          When placing your files on the server, do you use an FTP program? If so, you may have to upload your files in the BINARY mode of your FTP program. If you upload a *.class file in ASCII mode, you'll get a "Bad Magic Number" error.

          Solutions? Try to recompile your applet in and upload it using the method above.


          PS: If you need any more help or information, please feel free to contact me.
          • 2. Re: Bad magic number
            Hi there

            the problem was not with the class files. It appeared only when i put them (the jar ) in the iplanet 6.0 application server context. On the web server they were ( and are ) working just fine.

            The reason of Bad Magic Number in this case has to be something different, I guess.

            Tell me one thing, if the class files are found in the jar, does it also searches for the files on the disk. i.e. if the files are available in the jar and another copy (may be of different version) is available on disk, would it be a problem ?

            I'm planing a try with only jar files present over there and nothing (no more extra copies of class files).

            Please give it a thought and revert back...




            • 3. Re: Bad magic number
              Yes, you should be able to run your apps with just JAR files. And as for your Web server "Bad Magic Number" errors, serveral things may be possible:

              -The way you archive your classes in the JAR file may be incorrect (highly unlikely... but then again, stranger things have happened)
              -The app server and the web server don't support the same types of files
              -Perhaps the app server and the web server are running different JVMs (just a thought...)
              -Or maybe the JDK that you're running is different on the two servers

              I hope this helps somewhat. If you need more information, I found that when I searched using "Google" using the query:

              Java "Bad Magic Number" jar archives

              Seems to return some good results.