玩! Framework和ElasticSearch StackOverflowError

时间:2013-10-03 02:29:01

标签: java playframework playframework-2.0 elasticsearch

我正在玩Play!框架版本2.1.5,在QBox.io上使用Jest 0.0.4和ElasticSearch 0.90.5。

我有以下代码:

try {
    SearchConfig config = new SearchConfig(); 
    JestClient client = config.jestClient();
    Logger.debug("client exists");
    Index index = new Index.Builder(post).index("ads").type("ad").build();
    Logger.debug("index exists");

    client.execute(index);
    Logger.debug("post client.execute()");
} catch (IOException e) {
    e.printStackTrace();
} catch (Exception e) {
    e.printStackTrace();
}

运行时出现以下错误:

[debug] application - client exists
[debug] application - index exists
[debug] application - index: io.searchbox.core.Index@2ddf188f
[error] application - 

! @6fnicco9i - Internal server error, for (POST) [/user/posts] ->

play.api.Application$$anon$1: Execution exception[[RuntimeException: java.lang.StackOverflowError]]
    at play.api.Application$class.handleError(Application.scala:287) ~[play_2.10.jar:2.1.5]
    at play.api.DefaultApplication.handleError(Application.scala:381) [play_2.10.jar:2.1.5]
    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.5]
    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.5]
    at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10.jar:2.1.5]
    at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10.jar:2.1.5]
java.lang.RuntimeException: java.lang.StackOverflowError
    at play.libs.F$Promise$6.apply(F.java:401) ~[play_2.10.jar:2.1.5]
    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.StackOverflowError: null
    at com.google.gson.stream.JsonWriter.writeDeferredName(JsonWriter.java:401) ~[gson-2.2.3.jar:na]
    at com.google.gson.stream.JsonWriter.value(JsonWriter.java:495) ~[gson-2.2.3.jar:na]
    at com.google.gson.internal.bind.TypeAdapters$7.write(TypeAdapters.java:246) ~[gson-2.2.3.jar:na]
    at com.google.gson.internal.bind.TypeAdapters$7.write(TypeAdapters.java:231) ~[gson-2.2.3.jar:na]
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) ~[gson-2.2.3.jar:na]
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) ~[gson-2.2.3.jar:na]
[info] Compiling 1 Java source to /home/bcarlson/git/drillist/target/scala-2.10/classes...
[error] /home/bcarlson/git/drillist/app/controllers/Application.java:120: error: <identifier> expected
[error]                 Logger.debug("index: " + index.);
[error]                                                ^
[error] 1 error
[error] (compile:compile) javac returned nonzero exit code

我是Play和ElasticSearch(和Jest)的新手,我不知道如何解决这个SOError问题。任何帮助表示赞赏!提前谢谢!

-Ben

1 个答案:

答案 0 :(得分:0)

增加应用的堆栈大小无济于事?

可以使用jvm选项-Xss4m来完成,其中4m大于os上的默认值。