pythonaddict
pythonaddict

Reputation: 283

Jetty 9.4 giving ArrayIndexOutOfBoundsException

I am trying to deploy my war file on jetty 9.4 ( tried both 9.4.0 and 9.4.8 with asm 5.1 and 6 respectively). I am getting below error. I am using java 1.8 for development

java.lang.RuntimeException: Error scanning entry org/aspectj/org/eclipse/jdt/internal/compiler/parser/UpdateParserFiles.class from jar file:///tmp/jetty-0.0.0.0-8080-xxxxx-service-8.0.0.0000-SNAPSHOT.war-_xxxx-8.0.0.0000-SNAPSHOT-any-4304648590162252598.dir/webapp/WEB-INF/lib/aspectjtools-1.8.13.jar
at org.eclipse.jetty.annotations.AnnotationParser.lambda$parseJar$0(AnnotationParser.java:883)
at java.util.TreeMap$ValueSpliterator.forEachRemaining(TreeMap.java:2893)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:875)
at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:839)
at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:161)
at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:468)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
at java.lang.Thread.run(Thread.java:745)
Caused by: 
java.lang.ArrayIndexOutOfBoundsException: 3379
at org.objectweb.asm.ClassReader.<init>(ClassReader.java:171)
at org.objectweb.asm.ClassReader.<init>(ClassReader.java:143)
at org.objectweb.asm.ClassReader.<init>(ClassReader.java:418)
at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:933)
at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:918)
at org.eclipse.jetty.annotations.AnnotationParser.lambda$parseJar$0(AnnotationParser.java:879)
at java.util.TreeMap$ValueSpliterator.forEachRemaining(TreeMap.java:2893)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:875)
at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:839)
at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:161)
at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:468)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
at java.lang.Thread.run(Thread.java:745)​

Upvotes: 3

Views: 2091

Answers (1)

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49472

The cause of that error is likely that you have too old of an ASM jar on the server side classpath.

I know you said you have already tried newer versions, but have you checked all the jars on your server classpath for all possible instances of ASM classes?

If you are using , pay attention to your server Classpath, be 100% sure you don't have those ASM classes in multiple jars!

Also, under some configurations in , the webapp's own WEB-INF/lib/*.jar could be used to scan the classes in that webapp. Which means an incompatible WEB-INF/lib/asm*.jar could be causing you problems.

  • For Java 1.8 bytecode and runtime, use ASM 5.1+
  • For Java 9 bytecode and runtime, use ASM 6+

The other issue is that you could have classes in that jar WEB-INF/lib/aspectjtools-1.8.13.jar which are for a bytecode that is higher then your runtime JVM (or ASM) can handle.

If you are working with JEP 238 (Multi-Release JAR spec) jars then this is more common, but I don't think aspectjtools-1.8.13.jar is one of those (note: haven't actually downloaded that jar and studied it)

Upvotes: 5

Related Questions