Lombok: runtime error on tomcat 8

Created on 2 Aug 2018  Â·  4Comments  Â·  Source: projectlombok/lombok

When on Tomcat 8.0 with Java 8 the following exception occurs when starting application:

02-Aug-2018 14:25:42.500 SEVERE [localhost-startStop-3] org.apache.catalina.startup.ContextConfig.processAnnotationsJar Unable to process Jar entry [module-info.class] from Jar [file:/E:/apache-tomcat-8.0.36/webapps/myapp/WEB-INF/lib/lombok-1.16.22.jar] for annotations
 org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19
    at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:97)
    at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:55)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:176)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:85)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2042)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1988)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1958)
    at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1912)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1157)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:779)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:306)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5202)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:940)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1816)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Is there anything what can be done against this?
I just reverted all my code not using lombok anymore but only because i haven`t found a solution yet.

Most helpful comment

If you use maven, make sure the scope of the import is "provided". That
should make sure it isn't on the classpath

Op do 2 aug. 2018 19:38 schreef Jan Rieke notifications@github.com:

There is no need for lombok.jar to be present at runtime. So simply
removing the jar should fix this.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/rzwitserloot/lombok/issues/1801#issuecomment-410008825,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAKCRT1uYLtwWqHz1Rj_EuowxQHQ5n2Fks5uMzkegaJpZM4VsbMC
.

All 4 comments

There is no need for lombok.jar to be present at runtime. So simply removing the jar should fix this.

If you use maven, make sure the scope of the import is "provided". That
should make sure it isn't on the classpath

Op do 2 aug. 2018 19:38 schreef Jan Rieke notifications@github.com:

There is no need for lombok.jar to be present at runtime. So simply
removing the jar should fix this.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/rzwitserloot/lombok/issues/1801#issuecomment-410008825,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAKCRT1uYLtwWqHz1Rj_EuowxQHQ5n2Fks5uMzkegaJpZM4VsbMC
.

@randakar Your solution definately works - i just tested it.
But is there a way to fix this with the jar being in the path (to make this more robust)?

@arnonuem No. We include a java9 module-info.class for a reason. You should probably update your tomcat to hande other java9 code anyway.

Or file a bug report with tomcat to not parse module-info.class if the jvm is below 9.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pgaschuetz picture pgaschuetz  Â·  42Comments

t-kuester picture t-kuester  Â·  31Comments

lombokissues picture lombokissues  Â·  46Comments

krzyk picture krzyk  Â·  88Comments

Krasnyanskiy picture Krasnyanskiy  Â·  39Comments