Class loader problem with Lombok

2,457 views
Skip to first unread message

Jason Kurs

unread,
Nov 20, 2016, 5:12:27 PM11/20/16
to vert.x
I am getting this issue with Lombok, but could not see that anybody else has encountered this issue. My code fails to compile with vertx run server.java and I receive this back:

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 Server extends AbstractVerticle {
       ^
  at lombok.javac.apt.LombokProcessor.init(LombokProcessor.java:84)
  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:54)
  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 io.vertx.core.impl.verticle.CompilingClassLoader.<init>(CompilingClassLoader.java:104)
  at io.vertx.core.impl.JavaVerticleFactory.createVerticle(JavaVerticleFactory.java:38)
  at io.vertx.core.impl.DeploymentManager.createVerticles(DeploymentManager.java:184)
  at io.vertx.core.impl.DeploymentManager.lambda$doDeployVerticle$2(DeploymentManager.java:157)
  at io.vertx.core.impl.FutureImpl.checkCallHandler(FutureImpl.java:158)
  at io.vertx.core.impl.FutureImpl.setHandler(FutureImpl.java:100)
  at io.vertx.core.impl.DeploymentManager.doDeployVerticle(DeploymentManager.java:130)
  at io.vertx.core.impl.DeploymentManager.doDeployVerticle(DeploymentManager.java:102)
  at io.vertx.core.impl.DeploymentManager.deployVerticle(DeploymentManager.java:90)
  at io.vertx.core.impl.VertxImpl.deployVerticle(VertxImpl.java:574)
  at io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer.deploy(VertxIsolatedDeployer.java:46)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at io.vertx.core.impl.launcher.commands.ClasspathHandler.deploy(ClasspathHandler.java:160)
  at io.vertx.core.impl.launcher.commands.RunCommand.deploy(RunCommand.java:389)
  at io.vertx.core.impl.launcher.commands.RunCommand.run(RunCommand.java:262)
  at io.vertx.core.impl.launcher.VertxCommandLauncher.execute(VertxCommandLauncher.java:230)
  at io.vertx.core.impl.launcher.VertxCommandLauncher.dispatch(VertxCommandLauncher.java:365)
  at io.vertx.core.impl.launcher.VertxCommandLauncher.dispatch(VertxCommandLauncher.java:328)
  at io.vertx.core.Launcher.main(Launcher.java:49)
  Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.processing.JavacProcessingEnvironment
  at java.lang.ClassLoader.findClass(ClassLoader.java:530)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
  at lombok.launch.ShadowClassLoader.loadClass(ShadowClassLoader.java:418)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  ... 37 more 

I have added the lombok.jar to my classpath (I believe). I would greatly appreciate some help!

Jez P

unread,
Nov 20, 2016, 5:24:08 PM11/20/16
to vert.x
This might be helpful

http://stackoverflow.com/questions/25607272/compiling-a-java-class-in-memory-with-lombok-annotations-and-java-jdk-8

You need tools.jar on your classpath, presumably to enable the compile time annotation processing involved in Lombok

Jason Kurs

unread,
Nov 20, 2016, 6:02:59 PM11/20/16
to vert.x
Great! That fixed that problem, but I was hoping that it would also fix some other compilation errors. I still get some cannot find symbol errors that do not appear inside of my IDE. I was hoping they would be fixed with Lombok being fixed because the functions that I am calling were created using annotations. Do you have any ideas?

Jez P

unread,
Nov 21, 2016, 3:32:16 AM11/21/16
to vert.x
Sorry, you've exhausted my knowledge of "run-time compilation". I'm sure it's something to do with enabling the annotation processing but like I said, I don't know much about how to use the compiler at run-time. Maybe you need to do something special to add the Lombok classes to your compile class path for the embedded compiler, or maybe you need to do something special to enable the annotation processing. 
Reply all
Reply to author
Forward
0 new messages