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

倾然丶 夕夏残阳落幕 提交于 2019-12-01 18:23:21

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>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!