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

    Bad magic number

    807596
      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
      number)

      exception.

      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
      situation.

      thanks and regards

      raghav..


      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
          807596
          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.

          Ed

          PS: If you need any more help or information, please feel free to contact me.
          • 2. Re: Bad magic number
            807596
            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...

            regards


            raghav..

            s_raghu20@yahoo.com

            • 3. Re: Bad magic number
              807596
              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.

              Ed