Why is a lambda expression breaking guice error handling when i try to start jetty?

后端 未结 1 1904
孤城傲影
孤城傲影 2021-01-19 14:23

I face the following problem where i try to start jetty, i get the following exeption:

Execution default-test of goal org.apache.maven.plugins:maven-surefire         


        
相关标签:
1条回答
  • 2021-01-19 14:32

    This unreadable exception occurs when you have a bad configuration in one of your guice modules and you are using Java 8 lambdas and guice 3.

    I have spent a lot of time with this issue. Each time, I solved the problem by upgrading to guice 4 beta. One of its features is:

    Better Java8 runtime compatibility

    If you use maven:

    <dependency>
      <groupId>com.google.inject</groupId>
      <artifactId>guice</artifactId>
      <version>4.0-beta5</version>
    </dependency>
    

    This new version will give you a clear error message and a proper stacktrace that will let you find the problem. When you have solved it, you can switch back to guice 3.0 or continue to using the 4.0-beta (which is - from what I've seen - already stable).


    Edited the 2016/07/13

    Note that guice 4.0 and 4.1 have been released. So you should use the latest release:

    <dependency>
      <groupId>com.google.inject</groupId>
      <artifactId>guice</artifactId>
      <version>4.1.0</version>
    </dependency>
    
    0 讨论(0)
提交回复
热议问题