HELP!!! java.lang.ClassFormatError: (Truncated class file)

Hello all,
I'm writing a ClassLoader and the funniest things are happening. If I load a compiled class for the first time after compilation everything is ok. Once I change the class and recompile it, it starts putting out java.lang.ClassFormatError: (Truncated class file). If I alter the changes back to normal and recompile. It works again. Is there some sort of buffer which keeps the once loaded class in memory, even after rebooting?
Please help, I'm at a loss
Gideon

hi dmbdmb,
I got following error when try to run a java code in JBoss.
15:39:56,696 ERROR [LogInterceptor] Unexpected Error:
java.lang.ClassFormatError: Thilina (Truncated class file)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
at com.sun.tools.javac.v8.StringCompiler$Loader.findClass(StringCompiler
.java:63)
at com.sun.tools.javac.v8.StringCompiler.executeMethodWithReturnType(Str
ingCompiler.java:120)
at cc.aot.qVoice.domain.ejb.qVoiceManager.qVoiceManagerEJB.getVxmlString
(qVoiceManagerEJB.java:125)
I use JBoss 3.0.6 and sdk 1.4. In my program, classes are create and load on the fly. Then using Reflection API I called some
methods in the dynamically created class(this class not
write into a file and it is taken as a String variable).
I refferd this url as a guid to write class loader and compiler.(actually same thing i copied
from there and change it's name Pmat1 to StringCompiler)
http://forum.java.sun.com/thread.jsp?thread=347467&forum=4&message=1439418
When I run this as a normal application, it is work well. Then I try to run it in a jboss and it will give the above error.
In here I Wote some EJBs and struts also and i called the methodds in the StringCompiler(Pamat1) class in a EJB. Thilina is
the name of the dynamically created calss and StringCompiler is the class that includes the class loader and compiler methods
as in the above url. qVoiceManagerEJB has a getvxmlString method. Whithin this method
i called required the methods in the String compiler.
Can u some body help me. Thanx in advanced for any help.
anjithalb

Similar Messages

  • Java.lang.ClassFormatError: Truncated class file

    Hi
    Previously my application is running on jdk 1.4 and its supporting castor i.e. castor-0.9.5.4-xml.jar
    Now i had upgrade my jdk to 1.6 and i am using same castor.jar
    so it is giving me following error
    Exception in thread "main" java.lang.ClassFormatError: Truncated class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
    at com.sun.tools.javac.v8.GenerateClass$Loader.findClass(GenerateClass.j
    ava:273)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at org.exolab.castor.mapping.loader.Types.typeFromName(Types.java:93)
    at org.exolab.castor.mapping.loader.MappingLoader.resolveType(MappingLoa
    der.java:228)
    at org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(Mappi
    ngLoader.java:394)
    at org.exolab.castor.xml.XMLMappingLoader.createDescriptor(XMLMappingLoa
    der.java:202)
    at org.exolab.castor.mapping.loader.MappingLoader.loadMapping(MappingLoa
    der.java:258)
    at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:291)
    at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:246)
    at org.exolab.castor.xml.Marshaller.setMapping(Marshaller.java:520)
    I also try to upgrade castor to latest version i.e castor1.2-xml.jar with jdk 1.6 and this time it gives me error
    Exception in thread "main" java.lang.ClassFormatError: Truncated class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
    at com.sun.tools.javac.v8.GenerateClass$Loader.findClass(GenerateClass.j
    ava:273)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at org.exolab.castor.mapping.loader.Types.typeFromName(Types.java:92)
    at org.exolab.castor.mapping.loader.AbstractMappingLoader.resolveType(Ab
    stractMappingLoader.java:384)
    at org.exolab.castor.xml.XMLMappingLoader.createClassDescriptor(XMLMappi
    ngLoader.java:209)
    at org.exolab.castor.mapping.loader.AbstractMappingLoader.createClassDes
    criptors(AbstractMappingLoader.java:262)
    at org.exolab.castor.xml.XMLMappingLoader.loadMapping(XMLMappingLoader.j
    ava:156)
    at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmars
    haller.java:162)
    at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmars
    haller.java:128)
    at org.exolab.castor.xml.Marshaller.setMapping(Marshaller.java:556)
    Can any one please help me out..
    Thanks in advance

    hi,
    i think one of application's class file currupted , Recompile all java files and then try.
    Edited by: sagar_birari on Mar 27, 2008 5:47 AM
    Edited by: sagar_birari on Mar 27, 2008 7:20 AM

  • Problem with:error: java.lang.ClassFormatError: Truncated class file

    Hello, I created an simple applet writing "hello world". Now I would like to add *.class file to my serwer witch I've implemented on microcontroller P89C51RD2BN.
    Serwer is programmed with hex file which is created after compiling C source files. In this case I converted .class file to array in C (using hexedit program). When I am (using IE ) browsing my serwer Html site is loading corectly and *.class file is send from serwer also corectly (define arrays are transfered corectly) but applet is not initiated. When I am runnig Java console I can see this:
    error: java.lang.ClassFormatError: Truncated class file
    When I am runnig the same site with the same class file on my PC everything is ok.
    I would be greatfull for any help. Thx. (sorry for my English :P )

    Not too familiar with native compilation, which I believe you are trying to accomplish here. It would appear that you don't have any problems running your applet, more or less running it after being converted to legacy code. Try the "native methods" forum under "Fundementals/Key Classes", this may be helpful. Sorry for not being too helpful.

  • Exception in thread "main" java.lang.ClassFormatError

    i was trying out a basic program just to create a button using swing, and initially it did run fine. but later on i had to scrap it and start over, and on compiling it at that point, it gave me the following error:
    Exception in thread "main" java.lang.ClassFormatError: Button1 (Truncated class
    file)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    The code i used was as follows:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Button1 extends JFrame {
         private JButton enter;
         public Button1()
              super("Testing Buttons");
              Container c = getContentPane();
                   c.setLayout(new FlowLayout());
                   enter = new JButton("Click to enter");
                   c.add(enter);
                   ButtonHandler handler = new ButtonHandler();
                   enter.addActionListener(handler);
                   setSize(275, 100);
                   show();
         public static void main(String args[])
              Button1 app = new Button1();
              app.addWindowListener(
                        new WindowAdapter() {
                             public void windowClosing(WindowEvent e)
                   System.exit(0);
         private class ButtonHandler implements ActionListener {
              public void actionPerformed(ActionEvent e)
                   JOptionPane.showMessageDialog(null, "you pressed: " + e.getActionCommand());
    Could someone please help?
    Also, as i'm new to the lang, could anyone just give me a small sample snippet as to how to produce a new frame/window on clicking a button, the new frame in turn having 2 more buttons which on being clicked generate a (distinct) frame each?
    thnx!

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Button1 extends JFrame {
    private JButton enter, open;
    private static int count = 0;
    public Button1()
    super("Testing Buttons " + count);
    Container c = getContentPane();
    c.setLayout(new FlowLayout());
    enter = new JButton("Click to enter");
    c.add(enter);
    count ++ ;     
    if(count > 1){
         open = new JButton("Click to open");
         c.add(open);
         open.addActionListener(new ButtonHandler());
    enter.addActionListener(new ButtonHandler());
    this.addWindowListener(new WindowsHandler());
    setSize(275, 100);
    show();
    public static void main(String args[])
              new Button1();
    private class ButtonHandler implements ActionListener {
    public void actionPerformed(ActionEvent e)
    //JOptionPane.showMessageDialog(null, "you pressed: " + e.getActionCommand());
               new Button1();
    private class WindowsHandler implements WindowListener {
       public void windowOpened( WindowEvent e ){
       public void windowClosing( WindowEvent e ){
        System.exit(0);
       public void windowClosed( WindowEvent e ){
       public void windowIconified( WindowEvent e ){
       public void windowDeiconified( WindowEvent e ){
       public void windowActivated( WindowEvent e ){
       public void windowDeactivated( WindowEvent e ){
    }

  • Java.lang.ClassFormatError

    I have an ejb client application that works fine when deployed manually. I then decided to decided to deploy with Java Web Start, the deployment goes fine but some of the app. functions don't work and return an error on the console. Here is a copy of the error message.
    Java Web Start Console, started Thu Nov 13 10:38:39 EST 2003
    Java 2 Runtime Environment: Version 1.4.0_03 by Sun Microsystems Inc.
    Logging to file: C:\Test-me\Log.txt
    java.lang.ClassFormatError: cc/admin/email/client/AdministratorUI$18 (Illegal Variable name " val$jtf")
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at com.sun.jnlp.JNLPClassLoader.defineClass(Unknown Source)
         at com.sun.jnlp.JNLPClassLoader.access$1(Unknown Source)
         at com.sun.jnlp.JNLPClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at cc.admin.email.client.AdministratorUI.createTermAndYearDialog(AdministratorUI.java:440)
         at cc.admin.email.client.AdministratorUI.jMenuItemSCTAY_actionPerformed(AdministratorUI.java:398)
         at cc.admin.email.client.AdministratorUI.access$6000471(AdministratorUI.java:77)
         at cc.admin.email.client.AdministratorUI$6.actionPerformed(AdministratorUI.java:212)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.AbstractButton.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source).
    The portion of my code responsible for this is:
    final JTextField jtf = new JTextField(termAndYear[1]);
    jtf.addKeyListener(new JTextFieldFormat(jtf,4));
    jtf.addFocusListener(new java.awt.event.FocusAdapter() {
    public void focusGained(FocusEvent e) {
    jtf.setCaretPosition(0);
    jtf.selectAll();
    Apart from that action, the application works just fine. The interesting thing is, this does not happen if I run the application locally using the required jar files. It only happens when deployed with Java Web Start.
    I'll appreciate any help. Thanks

    hi,
    it looks like the class you want to load is broken. Can you send more information what app server do you use, which jre use this app server, and which java compiler do you use and the exact line were the exception trows.

  • ALERT: java/lang/ClassFormatError: Bad stack map.

    Hello friends.
    I need help. SOS.
    Where is wrong in this code?
    Problem is in comparision.
    Comenting this lines, all are ok.
            if(time1==time2)
                System.out.println("Equal");
            else
                System.out.println("Different");C�digo del Midlet:
    package borrame.pruebas;
    import java.util.Date;
    import javax.microedition.lcdui.Command;
    import javax.microedition.lcdui.CommandListener;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Displayable;
    import javax.microedition.lcdui.Form;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    public class Prueba extends MIDlet implements CommandListener {
        Display display;
        Form mainForm;
        // Comandos para salir y volver a la pantalla principal.
        Command cmdSalir;
        public Prueba() {
            super();
            mainForm = new Form ("HelloMidp");
            cmdSalir = new Command("Salir", Command.EXIT,1);
            mainForm.addCommand(cmdSalir);
            mainForm.setCommandListener(this);
        protected void startApp() throws MIDletStateChangeException {
            display = Display.getDisplay(this);
            display.setCurrent (mainForm);
            long time1 = new Date().getTime();
            long time2 = new Date().getTime() +100;
            System.out.println("time1: " + time1);
            System.out.println("time2: " + time2);
            System.out.println("time1 + time2 =" + (time1 + time2));
            if(time1==time2)
                System.out.println("Equal");
            else
                System.out.println("Different");
        protected void pauseApp() {
            // TODO Auto-generated method stub
        protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
            // TODO Auto-generated method stub
        public void commandAction(Command c, Displayable d) {
            if (c == cmdSalir) { // Selecciono salir de la aplicacion
                try {
                    destroyApp(false);
                } catch (MIDletStateChangeException e) {
                    e.printStackTrace();
                notifyDestroyed();
    }Output console:
    Warning: Cannot convert string "-b&h-lucida-medium-r-normal-sans-*-140-*-*-p-*-iso8859-1" to type FontStruct
    Running with storage root DefaultColorPhone
    ALERT: java/lang/ClassFormatError: Bad stack map.
    Method............: b7d29990 'com/sun/midp/midlet/MIDletState.createMIDlet (static)'
    Stack Chunk.......: b783d300
    Frame Pointer.....: b783d3a4
    Current IP........: b7da5669 = b7da565b + offset 14
    Previous Frame....: b783d36c
    Previous IP.......: b7d87f44 (offset 52)
    Frame size........: 7 (1 arguments, 6 local variables)
    Argument[0].......: b783cad0
    Local[1]..........: b78b35c8
    Local[2]..........: b7d87f41
    Local[3]..........: b783cc38
    Local[4]..........: b7d29788
    Local[5]..........: b78b355c
    Local[6]..........: 0
    Operand[1]........: b783cad0
    Method............: b7d16390 'com/sun/midp/midlet/Scheduler.schedule (virtual)'
    Stack Chunk.......: b783d300
    Frame Pointer.....: b783d36c
    Current IP........: b7d87f44 = b7d87f10 + offset 52
    Previous Frame....: b783d338
    Previous IP.......: b7d92b05 (offset 28)
    Frame size........: 7 (2 arguments, 5 local variables)
    Argument[0].......: b783cd14
    Argument[1].......: b783c460
    Local[2]..........: b78b20c4
    Local[3]..........: b78b3594
    Local[4]..........: b7d92b01
    Local[5]..........: b78b35a8
    Local[6]..........: b7d162b0
    Operand[1]........: b783cd14
    Method............: b7d1e084 'com/sun/midp/main/Main.runLocalClass (static)'
    Stack Chunk.......: b783d300
    Frame Pointer.....: b783d338
    Current IP........: b7d92b05 = b7d92ae9 + offset 28
    Previous Frame....: b783d314
    Previous IP.......: b7d9257c (offset 116)
    Frame size........: 3 (1 arguments, 2 local variables)
    Argument[0].......: b783d1bc
    Local[1]..........: b783c460
    Local[2]..........: b78b3570
    Method............: b7d1dfe4 'com/sun/midp/main/Main.main (static)'
    Stack Chunk.......: b783d300
    Frame Pointer.....: b783d314
    Current IP........: b7d9257c = b7d92508 + offset 116
    Previous Frame....: 0
    Previous IP.......: 1
    Frame size........: 3 (1 arguments, 2 local variables)
    Argument[0].......: b783d5ec
    Local[1]..........: b783d1bc
    Local[2]..........: b783cb24
    VM status:
    Instruction pointer.: b7da5669 (offset within invoking method: 14)
    Next instruction....: 0x4c
    Frame pointer.......: b783d3a4
    Local pointer.......: b783d388
    Stack size..........: 128; sp: b783d3bc; ranges: b783d308-b783d508;
    Contents of the current stack frame:
        b783d388: b783cad0 (lp)
        b783d38c: b78b35c8
        b783d390: b7d87f41
        b783d394: b783cc38
        b783d398: b7d29788
        b783d39c: b78b355c
        b783d3a0: 0
        b783d3a4: b783d36c (fp)
        b783d3a8: b7d87f44
        b783d3ac: b783d384
        b783d3b0: b7d29990
        b783d3b4: b783d300
        b783d3b8: 0 (end of frame)
        b783d3bc: b783cad0 (sp)
    Execution stack contains 184 items:
    b783d5ec
    b783d1bc
    b783cb24
    0
    1
    b78b3560
    b7d1dfe4
    b783d300
    0
    b783d1bc
    b783c460
    b78b3570
    b783d314
    b7d9257c
    b783d328
    b7d1e084
    b783d300
    0
    b783cd14
    b783c460
    b78b20c4
    b78b3594
    b7d92b01
    b78b35a8
    b7d162b0
    b783d338
    b7d92b05
    b783d34c
    b7d16390
    b783d300
    0
    b783cd14
    b783cad0
    b78b35c8
    b7d87f41
    b783cc38
    b7d29788
    b78b355c
    0
    b783d36c
    b7d87f44
    b783d384
    b7d29990
    b783d300
    0
    b783cad0
    Execution completed.
    717374 bytecodes executed
    5 thread switches
    742 classes in the system (including system classes)
    3720 dynamic objects allocated (102340 bytes)
    2 garbage collections (88196 bytes collected)
    Execution completed.
    717374 bytecodes executed
    5 thread switches
    742 classes in the system (including system classes)
    3720 dynamic objects allocated (102340 bytes)
    2 garbage collections (88196 bytes collected)

    My enviroment:
    Linux Gentoo.
    Sun JDK 1.4.2.10
    eclipse 3.2 WTP 1.5
    eclipseme 1.5.5
    Midlet config:
    MIDlet-Version: 1.0
    MicroEdition-Configuration: CLDC-1.0
    MicroEdition-Profile: MIDP-1.0
    WTK 2.2
    In last test, i'm using ktoolbar directly to build and execute midlet and all go ok.
    So, My code is not problem.
    I suppose that eclipseme corrupt my classes in build process.
    SOLUTION:
    My radical solution. I use eclipse without eclipseme, and i use ktoolbar to build, run, package, etc...
    Thank's

  • Java.lang.ClassFormatError: EDU/oswego/cs/dl/util/concurrent/ConcurrentRead

    Hi,
    I try to load an XML-File into my Applet with jdom4. But when reading in the Document with the SAX-Reader I get this Error:
    java.lang.ClassFormatError: EDU/oswego/cs/dl/util/concurrent/ConcurrentReaderHashMap (Bad magic number)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.dom4j.tree.NamespaceCache.<clinit>(NamespaceCache.java:48)
    at org.dom4j.Namespace.<clinit>(Namespace.java:24)
    at org.dom4j.DocumentFactory.createNamespace(DocumentFactory.java:161)
    at org.dom4j.tree.NamespaceStack.createNamespace(NamespaceStack.java:286)
    at org.dom4j.tree.NamespaceStack.getQName(NamespaceStack.java:167)
    at org.dom4j.io.SAXContentHandler.startElement(SAXContentHandler.java:221)
    at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)
    at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)
    at org.apache.crimson.parser.Parser2.parse(Unknown Source)
    at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)
    at org.dom4j.io.SAXReader.read(SAXReader.java:334)
    at org.dom4j.io.SAXReader.read(SAXReader.java:236)
    at client.Load.<init>(Load.java:42)
    at client.Login.startLoad(Login.java:183)
    at client.ParamTimer.run(ParamTimer.java:30)
    I use JRE 1.4.2_05! With JRE 1.5 I get a warning and then the JRE switches to his own SAX Parser.
    How can I solve this???
    Greets

    The error message says that the class file has a bad "magic number." Magic number is the first four bytes of a .class file and in a valid file they should be CA FE BA BE (in hex); "bad magic number" means that the first four bytes are something else and therefore it's not a valid Java .class file.

  • Java.lang.ClassFormatError: Bad major version number

    Hi friends,
    I am using JWS2.0(trial version). I have uploaded class files into servlet (and respective packages), every thing was working fine. one fine day i started getting the 404 - file not found error(JWS not yet expired). I uninstalled the jws, j2sdk1.4.0, jre1.4.0 but with no result.
    I even formated the system and loaded all again. But still i am getting the same problem.
    The servlet is the simple HelloWorld servlet.
    Through the SunExample its working fine. But the uploaded servlet is not getting recognised.
    Here is the ErrorLog
    [Tue Feb 22 17:26:29 GMT+05:30 2005] ClassLoaderFactory Error: Can not find Class : Hello [ ClassNotFoundException ]
    [Tue Feb 22 17:26:31 GMT+05:30 2005] ClassLoaderError: (com.sun.server.loader.JarClassLoader@17d67e:\servlets) ERROR: Unable to load class local class Hello
    [Tue Feb 22 17:26:31 GMT+05:30 2005] java.lang.ClassFormatError: Bad major version number
    at java.lang.ClassLoader.defineClass(ClassLoader.java:219)
    at com.sun.server.loader.ServletClassLoader.callDefineClass(ServletClassLoader.jav a:726)
    at com.sun.server.loader.ServletClassLoader.checkAndDefineClass(ServletClassLoader .java:620)
    at com.sun.server.loader.DirectoryClassLoader.getClassFromLocalDir(Compiled Code)
    at com.sun.

    Try re-compiling the Servlet. Make sure that the JDK version used to recompile is <= the version used to run the server (if you are using a higher jdk to compile the servlet, maybe Java 5.x, then you are to run, maybe Java 1.4.x, then use the -target option of javac to target the lower release...)

  • "Exception in thread "main" java.lang. No Class Def Found Error: Env"

    iam getting this erro message when i want to run the
    java program "Hello World"
    "Exception in thread "main" java.lang. No Class Def Found Error: Env"
    I have set environment variable for classpath and path for the jdk1.3.
    It is getting compiled without any error. When i try to run it it spits this error message:
    Help me......

    The problem could be from several reasons.
    If you're trying to run HelloWorld.java, you're class should defined as
    public class HelloWorld {
    public static void main(String[] args) {
    System.out.println("Hello World");
    This program must be in a file called HelloWorld.java
    to compile-- javac HelloWorld.java
    fo run--- java HelloWorld
    1. The class has to be public
    2. you must have a main method.
    3. The file must be named the name of your class(HelloWorld) with a .java extension.
    4. After you compile make sure there is a gile called HelloWorld.class in the directory you're working in
    Steve

  • Java.lang.ClassFormatError: HTML (Bad magic number)

    hi,
    i have quite a strange problem:
    when my applet tries to parse an XML file with SAX (no DTD-validation) i got the following error:
    java.lang.ClassFormatError: <HTML> (Bad magic number)
    Well i had some problems before with the ClassFormatError but they were because some class-files were corrupt. They were easy to fix because the defecitve class-file was written next to java.lang.ClassFormatError. This time i got the <HTML> expression next to the error. what does this mean?
    thnx in advance!
    marc

    Bad magic Number. means the first 4 bytes did not equals CAFEBABE (0xCAFEBABE) But why do you see <HTML> after that is beyound me. Can you locate which class is foul and replace it?

  • Java.lang.ClassFormatError: AppletSame (Bad magic number)??****

    I run a Japplet(AppletSame.class) ,found this Exception:
    java.lang.ClassFormatError: AppletSame (Bad magic number)??****
    what does it mean?how can i solve it?

    hi,
    the problem comes if there is some kind of problem with the class file and therefore the JVM cannot read the class file, try recompiling the program..
    cheerz
    ynkrish

  • Truncated class file !

    Hi folks,
    I've got a peculiar problem here :-( ...
    I've got this Java code (that uses an external jar) that compiles fine. But whenever I try to run the code it gives me a truncated class file error. And I am getting this error only in Solaris and not in Windows !!!
    Following is the trace that I am getting:
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:495)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:110)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
    at java.net.URLClassLoader.access$1(URLClassLoader.java:217)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:192)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:300)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:290)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:256)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
    Initially I thought that the class file might be broken. But even after numerous recompiling the problem is still persiisting :-(. Any idea fellas ?

    BadCoder,
    [Oh, wicked, bad naughty coder|http://www.sacred-texts.com/neu/mphg/mphg.htm#Scene%2011] (read it through then [consult the book of armaments|http://www.youtube.com/watch?v=xOrgLj9lOwk&feature=related]).
    Any idea fellas ? Nope. Absolutely none. I have consulted the chicken entrails, and the news ain't good. Have you considered suicude?\
    Yeah that might be overdoing things somewhat.
    So what happens if you compile on Solaris. Are you using the exact same versions of javac and java on both machines? Do you have control over that? Hint: you can install whichever JVM you like on solaris, to your ~ without affecting other users... but "the" version tends to age somewhat, what with a 5 year MTBF and all.
    Cheers. Keith.

  • Cannot convert ÿØÿà of type class java.lang.String to class BFileDomain.

    Hi All,
    I am using Jdeveloper 11.1.2.3.0.
    I have a scenario of making an ADF page where I have a IMAGE field to show on the page. So,I have a table called "PRODUCT" with fields called photo with BFILE type. Now when I the data i have inserted using the DML command and i can see the path at the backend.
    However,when i am runnig my ADF page in the Filed called "PHOTO" I can only see a junk character stating 'yoyo'.
    When I click on it, it says ERROR "Cannot convert ÿØÿà of type class java.lang.String to class oracle.jbo.domain.BFileDomain".
    Your help will be appreciated ASAP.
    Regards,
    Shahnawaz

    Hi,
    did you show the id-value in the user interface as a input-component, and did the input-component include a converter?
    If yes, show the id as output-text and remove any existing converter-components.
    Best Regards

  • I have been getting java.lang.ClassNotFoundException: ZeroApplet.class and java.lang.ClassNotFoundException: JavaToJS.class crashes with JRE version 1.6.0_26-b03-384-10M3425 VM executing a Java Applet. Is Apple aware of this problem? No longer supported?

    My web page uses a Java Applet to allow my visitors to replay chess games; the Chess Viewer Deluxe applet was written by Nikolai Pilafov some time ago and has been working properly for some time (until recently). I don't monitor this part of my site regularly so I am not sure when it began to fail. On his web site [http://chesstuff.blogspot.com/2008/11/chess-viewer-deluxe.html] he has a link to check LiveConnect object functionality (which fails for OBJECT tags). His recommendation is to "seek platform specific support which might be available from the JRE developers for your platform".
    I have been getting java.lang.ClassNotFoundException: ZeroApplet.class and java.lang.ClassNotFoundException: JavaToJS.class crashes with JRE version 1.6.0_26-b03-384-10M3425 VM executing a Java Applet. Until I checked the LiveConnect object functionality, I was unable to identify the source of the console error messages. This does seem to be the smoking gun.
    Is Apple aware of this problem? Are these classes no longer supported? Has anyone else had this problem? You can attempt to recreate the problem locally by going to my web page: http://donsmallidge.com/DonSmallidgeChess.html
    Thanks in advance for any help you can provide!
    Abbreviated Java Console output:
    Java Plug-in 1.6.0_26
    Using JRE version 1.6.0_26-b03-384-10M3425 Java HotSpot(TM) 64-Bit Server VM
    load: class ZeroApplet.class not found.
    java.lang.ClassNotFoundException: ZeroApplet.class
        at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:211)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:144)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:662)
        at sun.applet.AppletPanel.createApplet(AppletPanel.java:807)
        at sun.plugin.AppletViewer.createApplet(AppletViewer.java:2389)
        at sun.applet.AppletPanel.runLoader(AppletPanel.java:714)
        at sun.applet.AppletPanel.run(AppletPanel.java:368)
        at java.lang.Thread.run(Thread.java:680)
    load: class JavaToJS.class not found.
    java.lang.ClassNotFoundException: JavaToJS.class
        at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:211)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:144)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:662)
        at sun.applet.AppletPanel.createApplet(AppletPanel.java:807)
        at sun.plugin.AppletViewer.createApplet(AppletViewer.java:2389)
        at sun.applet.AppletPanel.runLoader(AppletPanel.java:714)
        at sun.applet.AppletPanel.run(AppletPanel.java:368)
        at java.lang.Thread.run(Thread.java:680)

    I just went up to check the LiveConnect object functionality page AND IT WORKED THIS TIME! I must confess, this is very mysterious. I will do some more checking and reply here if I can determine why it is working now (and more importantly, why it didn't work before).

  • Windows Vista "java.lang.ClassNotFoundException: loader.class" error.

    Hello,
    Whenever I try to visit websites that have a java applet I get a dialogue with the following error:
    java.lang.ClassNotFoundException: loader.class.
    I have tried uninstalling/reinstalling java, and also adding the -xmx and -xms parameters for java applet runtime setting in control panel with various values from 128m to 1g.
    The applet at http://www.java.com/en/download/installed.jsp?detect=jre&try=1 does work and reports "CONGRATULATIONS, you have the Latest version of Java!", "Java Runtime Version 1.6.0."
    I have been experiencing this problem ever since I installed Windows Vista Home Premium a day or two ago. Any help is appreciated.
    Regards
    Greg
    =====================================
    Full output from Java Console
    =====================================
    Java Plug-in 1.6.0
    Using JRE version 1.6.0 Java HotSpot(TM) Client VM
    User home directory = C:\Users\Greg Taylor
    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
    p: reload proxy configuration
    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>
    load: class loader.class not found.
    java.lang.ClassNotFoundException: loader.class
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed.
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 10 more
    java.lang.ClassNotFoundException: loader.class
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed.
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 10 more

    ive been having the same problems, if youve resolved this problem, please tell me.
    all help is appreciated

Maybe you are looking for