Announcement Announcement Module
Collapse
No announcement yet.
java.lang.UnsupportedClassVersionError: Bad version number in .class file Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.lang.UnsupportedClassVersionError: Bad version number in .class file

    Hi All,
    I have created a simple hello World Webservice with spring integration.
    The service is able to upload successfully.
    But when i create a client code and run it, it shows me the following error,

    ava.lang.UnsupportedClassVersionError: Bad version number in .class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknow n 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)
    Exception in thread "main"


    The client code is,

    public static void main(String[] args) {
    // TODO Auto-generated method stub
    try {
    SpringAxisWSDLStub stub=new SpringAxisWSDLStub();
    MyOperationResponse resp=new MyOperationResponse();
    MyOperation op=new MyOperation();
    op.setInpMsg("Infy1");
    resp=stub.myOperation(op);
    System.out.println(resp.getOutMsg());

    } catch (AxisFault e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (RemoteException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

  • #2
    It is due to difference in JRE's used.

    The compilation JRE and running JRE should be same.

    Comment


    • #3
      Helped a lot.I got the same issue.Now it resolved after changing the correct JRE.

      Comment


      • #4
        Hi
        There might be the to JER library in your respective project.I also got the same error.I have just remove one JrE from the buid path .Now its working fine.
        TO remove from the buildpath go to
        Project->BulidPath->cofigureBuildPath->Library tab

        Comment

        Working...
        X