我正在尝试将play2-elasticsearch插件用于playframework2 2.1.3版 我刚刚完成了github示例所说的,唯一的修改就是更改此行以在本地IP地址上使用服务器。
elasticsearch.client="127.0.0.1:9300"
但是当我尝试运行该示例时,我得到以下异常,任何想法? 我在mac上用jdk1.7
使用play framework 2.1.3play.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 :(得分:2)
从堆栈跟踪中,您似乎使用了与play 2.1.3不兼容的0.5.4
版本(仅限播放2.1.0)。
如果查看README文件中的"versions" table,如果使用play 2.1.3,则会看到0.7-SNAPSHOT
版本是必需的。尝试使用这个。