Spray-can NoClassDefFoundError

牧云@^-^@ 提交于 2019-12-05 15:33:50

The reason is that shapeless 1.x and shapeless 2.x are not compatible. However, if you mix dependencies that depend on both versions of shapeless sbt's dependency manager will by default just evict the older version. That's what happened here:

> dependencyTree
myapp:myapp_2.11:1.0.0 [S]
  +-com.netaporter:scala-uri_2.11:0.4.7 [S]
  | +-org.parboiled:parboiled_2.11:2.0.1 [S]
  |   +-com.chuusai:shapeless_2.11:2.0.0 [S]
  |
  +-io.spray:spray-routing_2.11:1.3.3 [S]
  | +-com.chuusai:shapeless_2.11:1.2.4 (evicted by: 2.0.0)
  | +-io.spray:spray-http_2.11:1.3.3 [S]
  | | +-io.spray:spray-util_2.11:1.3.3 [S]
  | | +-org.parboiled:parboiled-scala_2.11:1.1.7 [S]
  | |   +-org.parboiled:parboiled-core:1.1.7
  | | ...

spray-routing still depends on shapeless 1.x while scala-uri relies on parboiled2 which depends on shapeless 2.x.

The solution is to use the spray-routing-shapeless2 module which was built specifically to help with problems like this.

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