0

我在安装了 Oracle Java 8(Java 7 也有同样的问题)的 Ubuntu VM 上运行 Activator 1.2.3。我正在尝试运行 Java Play 服务器来训练/开发。

它启动成功,我什至可以在浏览器中访问 UI,但大约一分钟后,无论我是否执行任何操作,Activator 都会崩溃/停止并出现以下错误:

/opt/activator/activator ui -Dhttp.address=0.0.0.0
Checking for a newer version of Activator (current version 1.2.3)...
... our current version 1.2.3 looks like the latest.
Found previous process id: 16189
FOUND REPO = activator-local @ file:/opt/activator-1.2.3/repository
Play server process ID is 16442
[info] play - Application started (Prod)
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:8888
java.lang.RuntimeException: Web server never started!
        at scala.sys.package$.error(package.scala:27)
        at activator.UIMain.checkAlive$1(UIMain.scala:164)
        at activator.UIMain.waitForServerStartup(UIMain.scala:169)
        at activator.UIMain.run(UIMain.scala:115)
        at activator.UIMain.run(UIMain.scala:87)
        at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
        at xsbt.boot.Launch$.withContextLoader(Launch.scala:129)
        at xsbt.boot.Launch$.run(Launch.scala:109)
        at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:36)
        at xsbt.boot.Launch$.launch(Launch.scala:117)
        at xsbt.boot.Launch$.apply(Launch.scala:19)
        at xsbt.boot.Boot$.runImpl(Boot.scala:44)
        at xsbt.boot.Boot$.main(Boot.scala:20)
        at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.lang.RuntimeException: Web server never started!
[info] application - onStop received closing down the app
[warn] application - AppManager onApplicationStop is disabled pending some 
refactoring so it works with FakeApplication in tests
4

1 回答 1

0

我刚刚意识到调用 CheckAlive 方法可能会失败,因为它正在尝试针对指定的 0.0.0.0 等 IP 进行测试,因为我希望它监听所有 IP 而不仅仅是 localhost(请参阅如何强制 Typesafe Activator 监听 0.0. 0.0:8888)。我将IP参数设置为VM的外部IP(10.0.2.15),现在看起来很稳定。

/opt/activator/activator ui -Dhttp.address=10.0.2.15

出于自动化目的,您还可以执行以下操作:

IP_ADDRESS=`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
/opt/activator/activator ui -Dhttp.address=${IP_ADDRESS} -Dhttp.port=8888 &
于 2014-07-22T21:09:58.907 回答