• java.lang.RuntimeException: wrong class format Caused by: org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException: null


    Spring Boot 启动的时候报的错

    使用Drools 5.6版本,Spring Boot1.5.8版本,JAVA8版本,Eclipse4.4.2版本。

    Google后在Stack上发现一个,中文较少,贴一下。

    原因是因为Eclipse不支持Java8编译Drools5.6版本。

    解决方案:

    给项目添加依赖:

    <dependency>
                <groupId>org.eclipse.jdt.core.compiler</groupId>
                <artifactId>ecj</artifactId>
                <version>4.5.1</version>
    </dependency>

    再次启动,OK

    报错内容:

    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'knowledgeBase': Invocation of init method failed; nested exception is java.lang.RuntimeException: wrong class format
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        ... 19 common frames omitted
    Caused by: java.lang.RuntimeException: wrong class format
        at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:263) ~[drools-compiler-5.6.0.Final.jar:5.6.0.Final]
        at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:203) ~[drools-compiler-5.6.0.Final.jar:5.6.0.Final]
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:102) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:122) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1188) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromVariantTypeSignature(LookupEnvironment.java:1244) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeArgumentsFromSignature(LookupEnvironment.java:1031) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1193) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createMethod(BinaryTypeBinding.java:495) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createMethods(BinaryTypeBinding.java:577) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.cachePartsFrom(BinaryTypeBinding.java:327) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:640) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:619) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:295) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:107) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:122) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.resolve(ParameterizedTypeBinding.java:851) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:100) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveTypesFor(BinaryTypeBinding.java:1016) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getExactMethod(BinaryTypeBinding.java:771) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.Scope.findExactMethod(Scope.java:893) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.lookup.Scope.getMethod(Scope.java:2234) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:401) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:314) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:913) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:447) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:189) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:406) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1131) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1219) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:528) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:759) ~[ecj-3.5.1.jar:na]
        at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:464) ~[ecj-3.5.1.jar:na]
        at org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:389) ~[drools-compiler-5.6.0.Final.jar:5.6.0.Final]
        at org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:49) ~[drools-compiler-5.6.0.Final.jar:5.6.0.Final]
        at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:410) ~[drools-compiler-5.6.0.Final.jar:5.6.0.Final]
        at org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:46) ~[drools-compiler-5.6.0.Final.jar:5.6.0.Final]
        at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:103) ~[drools-compiler-5.6.0.Final.jar:5.6.0.Final]
        at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:1196) ~[drools-compiler-5.6.0.Final.jar:5.6.0.Final]
        at org.drools.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:949) ~[drools-compiler-5.6.0.Final.jar:5.6.0.Final]
        at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:938) ~[drools-compiler-5.6.0.Final.jar:5.6.0.Final]
        at org.drools.compiler.PackageBuilder.addPackageFromDecisionTable(PackageBuilder.java:451) ~[drools-compiler-5.6.0.Final.jar:5.6.0.Final]
        at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:715) ~[drools-compiler-5.6.0.Final.jar:5.6.0.Final]
        at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51) ~[drools-compiler-5.6.0.Final.jar:5.6.0.Final]
        at org.drools.container.spring.beans.KnowledgeBaseBeanFactory.afterPropertiesSet(KnowledgeBaseBeanFactory.java:113) ~[drools-spring-5.6.0.Final.jar:5.6.0.Final]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        ... 26 common frames omitted
    Caused by: org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException: null
        at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:372) ~[ecj-3.5.1.jar:na]
        at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.createNameEnvironmentAnswer(EclipseJavaCompiler.java:287) ~[drools-compiler-5.6.0.Final.jar:5.6.0.Final]
        at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:258) ~[drools-compiler-5.6.0.Final.jar:5.6.0.Final]
        ... 74 common frames omitted
  • 相关阅读:
    电路中的VCC和VDD
    动态数码管 什么是位选 段选
    pytest文档62-内置fixture之request
    pytest文档61-fixture之name参数使用别名
    pytest文档60-pytest.main()的使用
    python笔记49-yaml文件中变量的使用(锚点& 与 引用*)
    python笔记48-面试题:m1={'a':1,'b':2,'c':1} 将同样的value的key集合在list里,输出{1:['a','c'],2:['b']}
    jenkins学习15-Allure报告不用登陆也能给领导看
    python接口自动化35-pyppeteer-install下载没反应,r.html.render() 下载无反应问题解决
    kvm内存优化--KSM
  • 原文地址:https://www.cnblogs.com/yidiandhappy/p/9008226.html
Copyright © 2020-2023  润新知