1

我正在尝试将 play2-elasticsearch 插件用于 playframework2 版本 2.1.3 我刚刚完成了 github 示例所说的,唯一的修改是更改此行以使用本地 IP 地址上的服务器。

elasticsearch.client="127.0.0.1:9300"

但是当我尝试运行该示例时,我得到以下异常,有什么想法吗?我在带有 jdk1.7 的 mac 上使用 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]
4

1 回答 1

2

从堆栈跟踪看来,您使用的0.5.4版本似乎与 play 2.1.3 不兼容(仅与 play 2.1.0 兼容)。

如果您查看 README 文件中的“版本”表,您会看到0.7-SNAPSHOT如果您使用 play 2.1.3,则需要该版本。尝试使用这个。

于 2013-08-26T08:53:55.517 回答