play2弹性搜索示例不适用于play2.1.3 [英] play2-elasticsearch example is not working with play2.1.3

查看:95
本文介绍了play2弹性搜索示例不适用于play2.1.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用play2-popsearch plugin for playframework2 2.1.3
我刚刚完成了github的例子说,唯一的修改是改变这一行来使用本地ip地址上的服务器。

  elasticsearch.client =127.0.0.1:9300

但是当我尝试运行这个例子,我得到以下异常,任何想法?
我正在使用play框架2.1.3在mac上与jdk1.7

  play.api.Application $$ anon $ 1:执行异常[[RuntimeException:java.lang.ExceptionInInitializerError]] 
在play.api.Application $ class.handleError(Application.scala:289)〜[play_2.10.jar:2.1.3]
在play.api.DefaultApplication.handleError(Application.scala:383)〜[play_2.10.jar:2.1.3]
在play.core.server.netty.PlayDefaultUpstreamHandler $$ anonfun $ play $核心$ server $ netty $ PlayDefaultUpstreamHandler $$ handle $ 1 $ 1.apply(PlayDefaultUpstreamHandler.scala:143)〜[play_2.10.jar:2.1.3]
在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]
在play.api.libs.concurrent.PlayPromise $$ anonfun $ extend1 $ 1.apply(Promise.scala:113)〜[play_2.10.jar:2.1.3]
在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
在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]
导致: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]
在indexing.IndexTest。< clinit>(IndexTe st.java:20)〜[na:na]
at services.HashThat.index(HashThat.java:35)〜[na:na]
at controllers.PostApi.addComment(PostApi.java: 96)〜[na:na]
在路线$$ anonfun $ routes $ 1 $$ anonfun $ applyOrElse $ 20 $$ anonfun $ apply $ 20.apply(routes_routing.scala:301)〜[na:na]
引起的:java.lang.NullPointerException:null
at com.github.cleverage.elasticsearch.IndexService。< clinit>(IndexService.java:43)〜[play2-elasticsearch-0.5.4.jar:0.5 .4]
在com.github.cleverage.elasticsearch.Index.getIndexPath(Index.java:36)〜[play2-elasticsearch-0.5.4.jar:0.5.4]
在com.github .cleverage.elasticsearch.Index $ Finder。< init>(Index.java:97)〜[play2-elasticsearch-0.5.4.jar:0.5.4]
在indexing.IndexTest。< clinit>( IndexTest.java:20)〜[na:na]
在services.HashThat.index(HashThat.java:35)〜[na:na]
在controllers.PostApi.addComment(PostApi.java: 96)〜[na:na]


解决方案

跟踪,似乎你使用 0.5.4 版本与播放2.1.3不兼容(仅播放2.1.0)。



如果你看README文件中的版本表,您将看到 0.7-SNAPSHOT 版本是必需的,如果您使用播放2.1.3。尝试使用这个。


I'm trying to use play2-elasticsearch plugin for playframework2 version 2.1.3 I have just done exactly the github example says, the only modification was to change this line to use the server on the local ip address.

elasticsearch.client="127.0.0.1:9300"

but when i try to run the example i get the following exception, any idea? I'm using play framework 2.1.3 on mac with jdk1.7

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]

解决方案

From the stack trace, it seems that you use the 0.5.4 version which is not compatible with play 2.1.3 (only with play 2.1.0).

If you look at the "versions" table in the README file, you will see that the 0.7-SNAPSHOT version is required if you use play 2.1.3. Try to use this one.

这篇关于play2弹性搜索示例不适用于play2.1.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆