javatomcatjerseyguice

Error during Tomcat startup - com.google.inject.internal.util.$ComputationException: java.lang.ArrayIndexOutOfBoundsException


I am trying to run another Tomcat instance on the same server. When I deploy application (Maven, Java 8, Guice 3.0, Jersey 1.19) on the first Tomcat 7, it startups and runs well. However, the same application in another Tomcat 7 does not startup properly:

java.util.logging.ErrorManager: 5
com.google.inject.internal.util.$ComputationException: java.lang.ArrayIndexOutOfBoundsException: 57912
    at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:553)
    at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:419)
    at com.google.inject.internal.util.$CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
    at com.google.inject.internal.util.$StackTraceElements.forMember(StackTraceElements.java:53)

...

Caused by: java.lang.ArrayIndexOutOfBoundsException: 57912
    at com.google.inject.internal.asm.$ClassReader.<init>(Unknown Source)
    at com.google.inject.internal.asm.$ClassReader.<init>(Unknown Source)
    at com.google.inject.internal.asm.$ClassReader.<init>(Unknown Source)

I have tried on Why is a lambda expression breaking guice error handling when i try to start jetty? discussion answer and switched from Guice 3 to 4 but it didn't change anything.

How to solve this problem?


Solution

  • It works after commenting lambda expressions in the app. However, I forgot that I have included .jar library which also use Guice 3 so after updating it to Guice 4, Tomcat started up:

    <dependency>
        <groupId>com.google.inject</groupId>
        <artifactId>guice</artifactId>
        <version>4.1.0</version>
    </dependency>