我正在尝试将play2-elasticsearch插件用于playframework2 2.1.3版,我刚刚完成了github示例中所说的内容,唯一的修改是更改了此行以在本地ip地址上使用服务器。
elasticsearch.client="127.0.0.1:9300"
但是当我尝试运行示例时,出现以下异常,任何想法吗?我在Mac和JDK1.7上使用Play Framework 2.1.3
play.api.Application$$anon$1: Execution exception[[RuntimeException: java.lang.ExceptionInInitializerError]] at play.api.Application$class.handleError(Application.scala:289) ~[play_2.10.jar:2.1.3] at play.api.DefaultApplication.handleError(Application.scala:383) ~[play_2.10.jar:2.1.3] at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$play$core$server$netty$PlayDefaultUpstreamHandler$$handle$1$1.apply(PlayDefaultUpstreamHandler.scala:143) ~[play_2.10.jar:2.1.3] at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$play$core$server$netty$PlayDefaultUpstreamHandler$$handle$1$1.apply(PlayDefaultUpstreamHandler.scala:139) ~[play_2.10.jar:2.1.3] at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) ~[play_2.10.jar:2.1.3] at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) ~[play_2.10.jar:2.1.3] java.lang.RuntimeException: java.lang.ExceptionInInitializerError at play.libs.F$Promise$6.apply(F.java:401) ~[play_2.10.jar:2.1.3] at scala.concurrent.Future$$anonfun$map$1.liftedTree2$1(Future.scala:253) ~[scala-library.jar:na] at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:249) ~[scala-library.jar:na] at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:249) ~[scala-library.jar:na] at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:29) ~[scala-library.jar:na] at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.liftedTree1$1(BatchingExecutor.scala:67) ~[akka-actor_2.10.jar:na] Caused by: java.lang.ExceptionInInitializerError: null at com.github.cleverage.elasticsearch.Index.getIndexPath(Index.java:36) ~[play2-elasticsearch-0.5.4.jar:0.5.4] at com.github.cleverage.elasticsearch.Index$Finder.<init>(Index.java:97) ~[play2-elasticsearch-0.5.4.jar:0.5.4] at indexing.IndexTest.<clinit>(IndexTest.java:20) ~[na:na] at services.HashThat.index(HashThat.java:35) ~[na:na] at controllers.PostApi.addComment(PostApi.java:96) ~[na:na] at Routes$$anonfun$routes$1$$anonfun$applyOrElse$20$$anonfun$apply$20.apply(routes_routing.scala:301) ~[na:na] Caused by: java.lang.NullPointerException: null at com.github.cleverage.elasticsearch.IndexService.<clinit>(IndexService.java:43) ~[play2-elasticsearch-0.5.4.jar:0.5.4] at com.github.cleverage.elasticsearch.Index.getIndexPath(Index.java:36) ~[play2-elasticsearch-0.5.4.jar:0.5.4] at com.github.cleverage.elasticsearch.Index$Finder.<init>(Index.java:97) ~[play2-elasticsearch-0.5.4.jar:0.5.4] at indexing.IndexTest.<clinit>(IndexTest.java:20) ~[na:na] at services.HashThat.index(HashThat.java:35) ~[na:na] at controllers.PostApi.addComment(PostApi.java:96) ~[na:na]
从堆栈跟踪中,您似乎使用了0.5.4与播放2.1.3不兼容的版本(仅与播放2.1.0不兼容)。
0.5.4
如果您查看自述文件中的“版本”表,则将看到0.7-SNAPSHOT使用播放2.1.3 的版本是必需的。尝试使用这个。
0.7-SNAPSHOT