java.lang.RuntimeException: wrong class format

Stack Overflow | thomson | 3 months ago
  1. 0

    wrong class format Bulding a Package from Java 7 to Java 8

    Stack Overflow | 2 years ago | gbs
    com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract org.drools.guvnor.client.rpc.BuilderResult org.drools.guvnor.client.rpc.ModuleService.buildPackage(java.lang.String,boolean,java.lang.String,java.lang.String,java.lang.String,boolean,java.lang.String,java.lang.String,boolean,java.lang.String) throws com.google.gwt.user.client.rpc.SerializationException' threw an unexpected exception: java.lang.RuntimeException: wrong class format
  2. 0

    When trying to run code for compile templates with latest JDK8 (For instance this example https://github.com/droolsjbpm/drools/blob/master/drools-examples/src/main/java/org/drools/examples/templates/SimpleRuleTemplateExample.java ) it will throw an exception like this: {code} Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: wrong class format at org.drools.template.parser.DefaultTemplateRuleBase.readRule(DefaultTemplateRuleBase.java:148) at org.drools.template.parser.DefaultTemplateRuleBase.<init>(DefaultTemplateRuleBase.java:62) at org.drools.template.parser.TemplateDataListener.<init>(TemplateDataListener.java:74) at org.drools.decisiontable.ExternalSpreadsheetCompiler.compile(ExternalSpreadsheetCompiler.java:95) at org.drools.decisiontable.ExternalSpreadsheetCompiler.compile(ExternalSpreadsheetCompiler.java:81) at org.drools.examples.templates.SimpleRuleTemplateExample.buildKBase(SimpleRuleTemplateExample.java:84) at org.drools.examples.templates.SimpleRuleTemplateExample.executeExample(SimpleRuleTemplateExample.java:49) at org.drools.examples.templates.SimpleRuleTemplateExample.main(SimpleRuleTemplateExample.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: java.lang.RuntimeException: wrong class format at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:263) at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:203) at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:102) at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:122) at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1188) at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromVariantTypeSignature(LookupEnvironment.java:1244) at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeArgumentsFromSignature(LookupEnvironment.java:1031) at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1193) at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createMethod(BinaryTypeBinding.java:495) at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createMethods(BinaryTypeBinding.java:577) at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.cachePartsFrom(BinaryTypeBinding.java:327) at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:640) at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:619) at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:295) at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:133) at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:183) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findImport(CompilationUnitScope.java:465) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findSingleImport(CompilationUnitScope.java:519) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInImports(CompilationUnitScope.java:368) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:444) at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:752) at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:464) at org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:389) at org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:49) at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:371) at org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:46) at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:102) at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:1006) at org.drools.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:842) at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:831) at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:441) at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:419) at org.drools.template.parser.DefaultTemplateRuleBase.readRule(DefaultTemplateRuleBase.java:139) ... 12 more Caused by: org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:372) at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.createNameEnvironmentAnswer(EclipseJavaCompiler.java:287) at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:258) ... 45 more {code} Workaround, which worked for me is to switch to Janino compiler (See Workaround description)

    JBoss Issue Tracker | 3 years ago | Marek Posolda
    java.lang.RuntimeException: java.lang.RuntimeException: wrong class format
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Unable to compile class for JSP - When accessing the application

    GitHub | 2 years ago | clement-bramy
    org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
  5. 0

    Start doing a pure Java 8 test in Travis

    GitHub | 2 years ago | dchambers
    org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException

    7 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException

      No message provided

      at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>()
    2. JDT Core
      ClassFileReader.<init>
      1. org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:372)
      1 frame
    3. org.drools.commons
      EclipseJavaCompiler$2.findType
      1. org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:254)
      2. org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:260)
      3. org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:217)
      3 frames
    4. JDT Core
      Compiler.compile
      1. org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:127)
      2. org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getType(PackageBinding.java:127)
      3. org.eclipse.jdt.internal.compiler.lookup.Scope.findType(Scope.java:1517)
      4. org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2612)
      5. org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:2309)
      6. org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:44)
      7. org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:130)
      8. org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:197)
      9. org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:138)
      10. org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:447)
      11. org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:189)
      12. org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:406)
      13. org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1131)
      14. org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1219)
      15. org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:528)
      16. org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:759)
      17. org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:464)
      17 frames
    5. org.drools.commons
      AbstractJavaCompiler.compile
      1. org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:351)
      2. org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
      2 frames
    6. org.drools.rule
      JavaDialect.compileAll
      1. org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)
      1 frame
    7. org.drools.compiler
      PackageBuilder.addKnowledgeResource
      1. org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)
      2. org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
      3. org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:690)
      4. org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:631)
      5. org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:290)
      6. org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488)
      6 frames
    8. org.drools.builder
      KnowledgeBuilderImpl.add
      1. org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
      1 frame