Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help: java.lang.ClassFormatError encountered

 
Joy Chen
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I implement one simple application and package it into a jar file, the web application server is weblogic 5.1.
In the weblogic.properties, I add the mime type for jnlp and the Java Web Start is successfully installed on my client machine.
When I use Java Web Start to load my application, the following error happens:
java.lang.ClassFormatError: Test (Bad magic number)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
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(ClassLoader.java:297)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Thread.java:484)
I don't know why, could you please give me some help?
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"pisces",
Please change your name to comply with the naming policy to which you agreed when you registered here..

For your publicly displayed name,
use a first name, a space, and a last name.

You can change your name here:
here

You can also find the naming policy here:
http://www.javaranch.com/name.jsp
Thank You!
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello Joy,
this error tells you that something is wrong with your class declaration.

public class ClassFormatError
extends LinkageError
Thrown when the Java Virtual Machine attempts to read a class file and determines that the file is malformed or otherwise cannot be interpreted as a class file.

it would help if you would paste the code where you declare the class Test.
Chantal
 
John Dale
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I recall, class files generated by some older java compilers violate the class file format in ways that are not tolerated by some 1.3.x JVMs, resulting in this message from those 1.3.x JVMs. I'm not sure whether this is the problem affecting you.
I think I saw the problem described in the Sun 1.3 release notes.
 
Joy Chen
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all, I just solved this problem and here are all the actions I took.
1. Restart the computer
2. Clear the Java Web Start cache
3. Recompile the program using jdk1.3.x and archive it to jar file
Then everything is ok.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic