使用play2-elasticsearch模块与play 2.2.1时出错,

时间:2013-12-18 12:40:11

标签: scala playframework-2.0 elasticsearch

我正在尝试使用https://github.com/cleverage/play2-elasticsearch中的play2-elasticsearch模块和scala中的play2.2.1。我的Build.scala看起来像:

object ApplicationBuild extends Build {

val appName         = "play-elastic"
val appVersion      = "1.0-SNAPSHOT"

val appDependencies = Seq(
    "com.clever-age" % "play2-elasticsearch" % "0.8-SNAPSHOT" 
)

val main = play.Project(appName, appVersion, appDependencies).settings(
    resolvers += Resolver.url("play-plugin-releases", new URL("http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns),
    resolvers += Resolver.url("play-plugin-snapshots", new URL("http://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots/"))(Resolver.ivyStylePatterns)
)
}

play.plugins:

9000:com.github.cleverage.elasticsearch.plugin.IndexPlugin

在application.conf

的末尾添加了以下内容
elasticsearch.local=false
elasticsearch.client="127.0.0.1:9300"
elasticsearch.index.name="play2-elasticsearch"
elasticsearch.index.settings="{ analysis: { analyzer: { my_analyzer: { type: \"custom\",      tokenizer: \"standard\" } } } }"
elasticsearch.index.clazzs="indexing.*"
elasticsearch.index.show_request=true

我使用了示例scala弹性搜索示例,并将代码添加到Application.scala中的索引方法。第一次访问应用程序时出现以下错误:

Caused by: java.lang.NullPointerException: null
at com.github.cleverage.elasticsearch.IndexService.<clinit>(IndexService.java:43) ~[play2-elasticsearch-0.8-SNAPSHOT.jar:0.8-SNAPSHOT]
at com.github.cleverage.elasticsearch.ScalaHelpers$IndexableManager$class.$init$(ScalaHelpers.scala:48) ~[play2-elasticsearch-0.8-SNAPSHOT.jar:0.8-SNAPSHOT]
at indexing.IndexTestManager$.<init>(IndexTest.scala:8) ~[classes/:na]
at indexing.IndexTestManager$.<clinit>(IndexTest.scala) ~[classes/:na]
at controllers.Application$$anonfun$index$1.apply(Application.scala:20) ~[classes/:na]
at controllers.Application$$anonfun$index$1.apply(Application.scala:17) ~[classes/:na]

但是之后会出现以下错误:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class indexing.IndexTestManager$
at controllers.Application$$anonfun$index$1.apply(Application.scala:20) ~[classes/:na]
at controllers.Application$$anonfun$index$1.apply(Application.scala:17) ~[classes/:na]
at play.api.mvc.ActionBuilder$$anonfun$apply$11.apply(Action.scala:255) ~[play_2.10.jar:2.2.1]
at play.api.mvc.ActionBuilder$$anonfun$apply$11.apply(Action.scala:255) ~[play_2.10.jar:2.2.1]
at play.api.mvc.ActionBuilder$$anonfun$apply$10.apply(Action.scala:221) ~[play_2.10.jar:2.2.1]
at play.api.mvc.ActionBuilder$$anonfun$apply$10.apply(Action.scala:220) ~[play_2.10.jar:2.2.1]

任何帮助将不胜感激。

0 个答案:

没有答案