将项目升级到spring boot 1.5.9(spring 4.3& tomcat 8.5.24)后,使用queryDSL的服务在运行时失败,因为它无法从jdk lib(tools.jar)中找到一个类)。
/Q_742623943_01321512155_128635432.java:1: warning: Can't initialize javac processor due to (most likely) a class loader problem: java.lang.NoClassDefFoundError: com/sun/tools/javac/processing/JavacProcessingEnvironment
public class Q_742623943_01321512155_128635432 {
^
at lombok.javac.apt.LombokProcessor.init(LombokProcessor.java:83)
at lombok.core.AnnotationProcessor$JavacDescriptor.want(AnnotationProcessor.java:87)
at lombok.core.AnnotationProcessor.init(AnnotationProcessor.java:140)
at lombok.launch.AnnotationProcessorHider$AnnotationProcessor.init(AnnotationProcessor.java:69)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$ProcessorState.<init>(JavacProcessingEnvironment.java:500)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors$ProcessorStateIterator.next(JavacProcessingEnvironment.java:597)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:690)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
at com.sun.tools.javac.main.Main.compile(Main.java:523)
at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
at com.mysema.codegen.JDKEvaluatorFactory.compile(JDKEvaluatorFactory.java:90)
at com.mysema.codegen.AbstractEvaluatorFactory.createEvaluator(AbstractEvaluatorFactory.java:76)
at com.mysema.codegen.AbstractEvaluatorFactory.createEvaluator(AbstractEvaluatorFactory.java:45)
at com.mysema.query.collections.DefaultEvaluatorFactory.create(DefaultEvaluatorFactory.java:120)
at com.mysema.query.collections.DefaultQueryEngine.project(DefaultQueryEngine.java:218)
at com.mysema.query.collections.DefaultQueryEngine.evaluateSingleSource(DefaultQueryEngine.java:190)
at com.mysema.query.collections.DefaultQueryEngine.list(DefaultQueryEngine.java:82)
at com.mysema.query.collections.AbstractColQuery.list(AbstractColQuery.java:149)
当我将tools.jar添加为gradle依赖项时,它可以工作,但这不是一个解决方案,因为不应该在项目中打包jdk库。
compile files(org.gradle.internal.jvm.Jvm.current().toolsJar)
我们使用的是旧版本的queryDSL(2.7.3),项目已将生成的代码提交给repo(这是一个旧项目,我宁愿在编译时生成)。
更新 在将tomcat降级到v7.0之后。*它再次开始工作。
知道tomcat 8有什么变化吗?好像它没有加载jdk库。
答案 0 :(得分:0)
确保Tomcat 8在jdk而不是jre上运行,那是因为tools.jar只是jdk的一部分。 在Tomcat安装期间,通常会选择jre。 我记得以前的tomcat需要一个jdk来进行jsp编译,然后他们为此添加了自己的编译器,以便tomcat可以在jre上运行。