我尝试在heroku上运行Tika服务器。Tika的构建和启动没有任何问题。但90秒后,Heroku扼杀了我的进程。
这在我的Procfile中:
web: java $JAVA_OPTS -jar tika-server/target/tika-server-1.13-SNAPSHOT.jar --port=$PORT
这是我得到的错误:
2016-04-19T10:10:36.582046+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -jar tika-server/target/tika-server-1.13-SNAPSHOT.jar --port=56206`
2016-04-19T10:10:38.271693+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx350m -Xss512k -Dfile.encoding=UTF-8
2016-04-19T10:10:38.268608+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2016-04-19T10:10:38.767221+00:00 app[web.1]: Apr 19, 2016 10:10:38 AM org.apache.tika.server.TikaServerCli main
2016-04-19T10:10:38.767231+00:00 app[web.1]: INFO: Starting Apache Tika 1.13-SNAPSHOT server
2016-04-19T10:10:39.104022+00:00 app[web.1]: Apr 19, 2016 10:10:39 AM org.apache.cxf.endpoint.ServerImpl initDestination
2016-04-19T10:10:39.104032+00:00 app[web.1]: INFO: Setting the server's publish address to be http://localhost:56206/
2016-04-19T10:10:39.163016+00:00 app[web.1]: Apr 19, 2016 10:10:39 AM org.slf4j.impl.JCLLoggerAdapter info
2016-04-19T10:10:39.163027+00:00 app[web.1]: INFO: jetty-8.y.z-SNAPSHOT
2016-04-19T10:10:39.193522+00:00 app[web.1]: Apr 19, 2016 10:10:39 AM org.slf4j.impl.JCLLoggerAdapter info
2016-04-19T10:10:39.193538+00:00 app[web.1]: INFO: Started SelectChannelConnector@localhost:56206
2016-04-19T10:10:39.207702+00:00 app[web.1]: Apr 19, 2016 10:10:39 AM org.apache.tika.server.TikaServerCli main
2016-04-19T10:10:39.207711+00:00 app[web.1]: INFO: Started
2016-04-19T10:12:06.672493+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
2016-04-19T10:12:06.672493+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-04-19T10:12:07.484941+00:00 heroku[web.1]: Process exited with status 137
2016-04-19T10:12:07.500331+00:00 heroku[web.1]: State changed from starting to crashed
2016-04-19T10:12:07.501167+00:00 heroku[web.1]: State changed from crashed to starting
有什么想法吗?
我自己找到了解决方案。您只需将--host标志设置为"0.0.0.0"即可。否则,该服务将不对公众开放,因此不会得到Heroku的认可。
新的Procfile:
web: java $JAVA_OPTS -jar tika-server/target/tika-server-1.13-SNAPSHOT.jar --host=0.0.0.0 --port=$PORT