我試圖將我的應用程序從Play 2.0.3遷移到最新版本的Play Framework(2.1.3)和play2-elasticsearch插件。play2-elasticsearch與播放框架2.1.3
修改插件自述文件我使用0.7-SNAPSHOT版本。
我SBT是:
"com.github.cleverage" % "elasticsearch_2.9.1" % "0.4.1"
,併成爲:
"com.clever-age" % "play2-elasticsearch" % "0.7-SNAPSHOT"
而且我得到在應用程序啓動NullPointerException異常:
play.api.Configuration$$anon$1: Configuration error[Cannot register class [models.indexing.ClientIndex] in Ebean server]
at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:81) ~[play_2.10.jar:2.1.3]
at play.api.Configuration.reportError(Configuration.scala:559) ~[play_2.10.jar:2.1.3]
at play.Configuration.reportError(Configuration.java:298) ~[play_2.10.jar:2.1.3]
at play.db.ebean.EbeanPlugin.onStart(EbeanPlugin.java:71) ~[play-java-ebean_2.10.jar:2.1.3]
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:68) ~[play_2.10.jar:2.1.3]
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:68) ~[play_2.10.jar:2.1.3]
at scala.collection.immutable.List.foreach(List.scala:309) ~[scala-library.jar:na]
at play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:68) ~[play_2.10.jar:2.1.3]
at play.api.Play$$anonfun$start$1.apply(Play.scala:68) ~[play_2.10.jar:2.1.3]
at play.api.Play$$anonfun$start$1.apply(Play.scala:68) ~[play_2.10.jar:2.1.3]
at play.utils.Threads$.withContextClassLoader(Threads.scala:18) ~[play_2.10.jar:2.1.3]
at play.api.Play$.start(Play.scala:67) ~[play_2.10.jar:2.1.3]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:141) ~[play_2.10.jar:2.1.3]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:114) ~[play_2.10.jar:2.1.3]
at scala.Option.map(Option.scala:145) ~[scala-library.jar:na]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:114) ~[play_2.10.jar:2.1.3]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:112) ~[play_2.10.jar:2.1.3]
at scala.util.Either$RightProjection.flatMap(Either.scala:523) ~[scala-library.jar:na]
at play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:112) ~[play_2.10.jar:2.1.3]
at play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:104) ~[play_2.10.jar:2.1.3]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) ~[scala-library.jar:na]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) ~[scala-library.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_09]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.7.0_09]
at java.lang.Thread.run(Unknown Source) [na:1.7.0_09]
Caused by: java.lang.ExceptionInInitializerError: null
at com.github.cleverage.elasticsearch.Index.getIndexPath(Index.java:37) ~[play2-elasticsearch-0.7-SNAPSHOT.jar:0.7-SNAPSHOT]
at com.github.cleverage.elasticsearch.Index$Finder.<init>(Index.java:144) ~[play2-elasticsearch-0.7-SNAPSHOT.jar:0.7-SNAPSHOT]
at models.indexing.ClientIndex.<clinit>(ClientIndex.java:18) ~[na:na]
at java.lang.Class.forName0(Native Method) ~[na:1.7.0_09]
at java.lang.Class.forName(Unknown Source) ~[na:1.7.0_09]
at play.db.ebean.EbeanPlugin.onStart(EbeanPlugin.java:69) ~[play-java-ebean_2.10.jar:2.1.3]
... 21 common frames omitted
Caused by: java.lang.NullPointerException: null
at com.github.cleverage.elasticsearch.IndexService.<clinit>(IndexService.java:43) ~[play2-elasticsearch-0.7-SNAPSHOT.jar:0.7-SNAPSHOT]
... 27 common frames omitted
所以我認爲情況a similar question解釋不是我的情況。
請幫我解決這個問題。
更新:
我ElasticSearch配置:
## ElasticSearch Configuration
##############################
## define local mode or not
elasticsearch.local=true
## list clients
# ex : elasticsearch.client="192.168.0.46:9300,192.168.0.47:9300"
## Name of the index
elasticsearch.index.name="play2-elasticsearch"
## Custom settings to apply when creating the index (optional)
# elasticsearch.index.settings="{ analysis: { analyzer: { my_analyzer: { type: \"custom\", tokenizer: \"standard\" } } } }"
## define package or class separate by commas for loading @IndexType and @IndexMapping information
elasticsearch.index.clazzs="models.*"
## show request & result json of search request in log
elasticsearch.index.show_request=true
您可以添加您的插件配置(=以「elasticsearch」開頭的所有鍵的配置值)。 – mguillermin