java.lang.RuntimeException: java.lang.RuntimeException: wrong class format

Stack Overflow | gbs | 2 years ago
  1. 0

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

    Stack Overflow | 2 years ago | gbs
    java.lang.RuntimeException: 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.createNameEnvironmentAnswer(EclipseJavaCompiler.java:287)
      2. org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:258)
      3. org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:203)
      3 frames
    4. JDT Core
      Compiler.compile
      1. org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:102)
      2. org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49)
      3. org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:122)
      4. org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1188)
      5. org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromVariantTypeSignature(LookupEnvironment.java:1244)
      6. org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeArgumentsFromSignature(LookupEnvironment.java:1031)
      7. org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1193)
      8. org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createMethod(BinaryTypeBinding.java:495)
      9. org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createMethods(BinaryTypeBinding.java:577)
      10. org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.cachePartsFrom(BinaryTypeBinding.java:327)
      11. org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:640)
      12. org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:619)
      13. org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:295)
      14. org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:133)
      15. org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:183)
      16. org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findImport(CompilationUnitScope.java:465)
      17. org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findSingleImport(CompilationUnitScope.java:519)
      18. org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInImports(CompilationUnitScope.java:368)
      19. org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:444)
      20. org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:752)
      21. org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:464)
      21 frames
    5. org.drools.commons
      AbstractJavaCompiler.compile
      1. org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:389)
      2. org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:49)
      2 frames
    6. org.drools.rule
      JavaDialect.compileAll
      1. org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:410)
      1 frame
    7. org.drools.compiler
      PackageBuilder.addPackageFromDrl
      1. org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:46)
      2. org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:103)
      3. org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:1196)
      4. org.drools.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:949)
      5. org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:938)
      6. org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:444)
      7. org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:422)
      7 frames
    8. Drools :: Templates
      DataProviderCompiler.compile
      1. org.drools.template.parser.DefaultTemplateRuleBase.readRule(DefaultTemplateRuleBase.java:139)
      2. org.drools.template.parser.DefaultTemplateRuleBase.<init>(DefaultTemplateRuleBase.java:62)
      3. org.drools.template.parser.TemplateDataListener.<init>(TemplateDataListener.java:74)
      4. org.drools.template.parser.TemplateDataListener.<init>(TemplateDataListener.java:50)
      5. org.drools.template.DataProviderCompiler.compile(DataProviderCompiler.java:58)
      5 frames
    9. org.drools.guvnor
      ModuleServiceServlet.rebuildPackages
      1. org.drools.guvnor.server.util.BRDRTPersistence.marshal(BRDRTPersistence.java:57)
      2. org.drools.guvnor.server.contenthandler.drools.BRLContentHandler.getSourceDRL(BRLContentHandler.java:84)
      3. org.drools.guvnor.server.contenthandler.drools.BRLContentHandler.compile(BRLContentHandler.java:61)
      4. org.drools.guvnor.server.builder.PackageAssemblerBase.compile(PackageAssemblerBase.java:91)
      5. org.drools.guvnor.server.builder.PackageAssemblerBase.buildAsset(PackageAssemblerBase.java:75)
      6. org.drools.guvnor.server.builder.PackageAssembler.addAsset(PackageAssembler.java:132)
      7. org.drools.guvnor.server.builder.PackageAssembler.loadAllButDRLAssets(PackageAssembler.java:115)
      8. org.drools.guvnor.server.builder.PackageAssembler.loadAssets(PackageAssembler.java:105)
      9. org.drools.guvnor.server.builder.PackageAssembler.buildPackage(PackageAssembler.java:97)
      10. org.drools.guvnor.server.builder.PackageAssembler.compile(PackageAssembler.java:68)
      11. org.drools.guvnor.server.RepositoryModuleOperations.buildModule(RepositoryModuleOperations.java:579)
      12. org.drools.guvnor.server.RepositoryModuleOperations.buildModule(RepositoryModuleOperations.java:550)
      13. org.drools.guvnor.server.RepositoryModuleOperations$Proxy$_$$_WeldClientProxy.buildModule(RepositoryModuleOperations$Proxy$_$$_WeldClientProxy.java)
      14. org.drools.guvnor.server.RepositoryModuleService.buildPackage(RepositoryModuleService.java:302)
      15. org.drools.guvnor.server.RepositoryModuleService.buildPackage(RepositoryModuleService.java:277)
      16. org.drools.guvnor.server.RepositoryModuleService.rebuildPackages(RepositoryModuleService.java:141)
      17. org.drools.guvnor.server.RepositoryModuleService$Proxy$_$$_WeldClientProxy.rebuildPackages(RepositoryModuleService$Proxy$_$$_WeldClientProxy.java)
      18. org.drools.guvnor.server.ModuleServiceServlet.rebuildPackages(ModuleServiceServlet.java:146)
      18 frames
    10. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:483)
      4 frames
    11. Jetty Contrib :: jetty-gwt RemoteServiceServlet
      AbstractRemoteServiceServlet.doPost
      1. com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
      2. com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
      3. com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
      4. com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
      4 frames
    12. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
      2. javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      2 frames
    13. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      2 frames
    14. Tomcat WS
      WsFilter.doFilter
      1. org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      1 frame
    15. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      2 frames
    16. Solder Implementation
      CatchExceptionFilter.doFilter
      1. org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
      1 frame
    17. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      2 frames
    18. Solder API
      ServletEventBridgeFilter.doFilter
      1. org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
      1 frame
    19. Glassfish Core
      StandardHostValve.invoke
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
      4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      5. org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
      6. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      6 frames
    20. com.googlecode.psiprobe
      Tomcat70AgentValve.invoke
      1. com.googlecode.psiprobe.Tomcat70AgentValve.invoke(Tomcat70AgentValve.java:38)
      1 frame
    21. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      2. org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      3. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      4. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      4 frames
    22. Grizzly HTTP
      JIoEndpoint$SocketProcessor.run
      1. org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
      2. org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
      3. org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
      3 frames
    23. Java RT
      ThreadPoolExecutor$Worker.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      2 frames
    24. Tomcat Util
      TaskThread$WrappingRunnable.run
      1. org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      1 frame
    25. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:745)
      1 frame