4 Replies Latest reply on Feb 15, 2010 12:28 PM by 843840

    'Bad magic number' Exception

    843833
      I've just got this very unusual (for me) exception. Anybody knows what das it mean?
      message:
      "500 Internal Server Error
      /LinkOpp/VendorAdmin:

      jrun__jsp__VendorAdmin2ejsp14 (Bad magic number)
      java.lang.ClassFormatError: jrun__jsp__VendorAdmin2ejsp14 (Bad magic number)
           at java.lang.ClassLoader.defineClass0(Native Method)
           at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
           at java.lang.ClassLoader.defineClass(ClassLoader.java:426)
           at allaire.jrun.jsp.JSPClassLoader.loadClass(../jsp/JSPClassLoader.java:104)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
           at allaire.jrun.jsp.JSPTranslator.loadClass(../jsp/JSPTranslator.java:141)
           at allaire.jrun.jsp.JSPTranslator.translate(../jsp/JSPTranslator.java:96)
           at allaire.jrun.jsp.JSPTranslator.translate(../jsp/JSPTranslator.java:67)
           at allaire.jrun.jsp.JSPServlet.service(../jsp/JSPServlet.java:216)
           at allaire.jrun.jsp.JSPServlet.service(../jsp/JSPServlet.java:196)
           at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1416)
           at allaire.jrun.session.JRunSessionService.service(../session/JRunSessionService.java:1082)
           at allaire.jrun.servlet.JRunSE.runServlet(../servlet/JRunSE.java:1270)
           at allaire.jrun.servlet.JRunRequestDispatcher.forward..."
        • 1. Re: 'Bad magic number' Exception
          843833
          Yeah I've seen that one before. Had us stumped for a long time. Turned out that we were using some funny characters in our JSP file in the HTML code. I think the copyright symbol did it for us.

          You might try removing any odd characters you have, or just try removing all or most of your HTML, to see which is causing the problem.

          -Derek
          • 2. Re: 'Bad magic number' Exception
            843833
            Thank you for your reply. Turned out to be some problem with precompilation. When all files had been removed from WEB-INF\jsp directory and all jsp compiled again from the top, everything started to work again. I guess jsp compiler just was trying to help.
            • 3. Re: 'Bad magic number' Exception
              843840
              I am getting the same exception in applet program. Bellow is the stack trace..

              Java Plug-in 1.6.0_10-rc2
              Using JRE version 1.6.0_10-rc2 Java HotSpot(TM) Client VM
              User home directory = C:\Documents and Settings\satish

              ----------------------------------------------------
              c: clear console window
              f: finalize objects on finalization queue
              g: garbage collect
              h: display this help message
              l: dump classloader list
              m: print memory usage
              o: trigger logging
              q: hide console
              r: reload policy configuration
              s: dump system and deployment properties
              t: dump thread list
              v: dump thread stack
              x: clear classloader cache
              0-5: set trace level to <n>
              ----------------------------------------------------

              java.lang.ClassFormatError: Incompatible magic value 218762506 in class file com/sns/legal/esi/PrintControlApplet/class
              at java.lang.ClassLoader.defineClass1(Native Method)
              at java.lang.ClassLoader.defineClass(Unknown Source)
              at java.security.SecureClassLoader.defineClass(Unknown Source)
              at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
              at java.lang.ClassLoader.loadClass(Unknown Source)
              at java.lang.ClassLoader.loadClass(Unknown Source)
              at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
              at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
              at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
              at java.lang.Thread.run(Unknown Source)
              Exception: java.lang.ClassFormatError: Incompatible magic value 218762506 in class file com/sns/legal/esi/PrintControlApplet/class


              Please suggest..
              • 4. Re: 'Bad magic number' Exception
                843840
                Satish.napster wrote:
                I am getting the same exception in applet program. Bellow is the stack trace..

                java.lang.ClassFormatError: Incompatible magic value 218762506 in class file com/sns/legal/esi/PrintControlApplet/class
                at java.lang.ClassLoader.defineClass1(Native Method)
                at java.lang.ClassLoader.defineClass(Unknown Source)
                at java.security.SecureClassLoader.defineClass(Unknown Source)
                at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
                at java.lang.ClassLoader.loadClass(Unknown Source)
                at java.lang.ClassLoader.loadClass(Unknown Source)
                at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
                at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
                at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
                at java.lang.Thread.run(Unknown Source)
                Exception: java.lang.ClassFormatError: Incompatible magic value 218762506 in class file com/sns/legal/esi/PrintControlApplet/class
                "218762506" is 0x0d0a0d0a or ("\r\n\r\n" or CR-LF-CR-LF).
                Please suggest..
                Nothing to do with JSPs.

                Please do not resurrect long dead threads with an unrelated problem.

                Looks like two blank lines (&#42;) are being prepended to the class when it is fetched.
                (&#42;) possibly more