0

我正在尝试使用 Java 在 Windows Azure 上开发我的第一个应用程序。我按照这里的教程:

http://msdn.microsoft.com/en-us/library/windowsazure/hh690944.aspx

但是,当我在 Windows Azure 模拟器中运行项目时(如教程中所述),模拟器卡在无限循环中。这是模拟器控制台的输出:

[fabric] Role Instance: deployment18(8).WindowsAzureDeploymentProject.WorkerRole1.0
[fabric] Role state Started
[runtime] Role entrypoint . CALLING   OnStart()
[runtime] Role entrypoint . COMPLETED OnStart()
[runtime] Role entrypoint . CALLING   Run()
[WaWorkerHost.exe] java.exe is running...
[WaWorkerHost.exe] java.exe stopped running - exiting...
[WaWorkerHost.exe] 
[WaWorkerHost.exe] 
[WaWorkerHost.exe] Exited with error code 1.
[runtime] Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED
[runtime] Role instance recycling is starting
[fabric] Role state Stopping
[runtime] Role entrypoint . CALLING   OnStop()
[runtime] Role entrypoint . COMPLETED OnStop()
[fabric] Role state Busy
[fabric] Role state Unhealthy
[fabric] Role state Started
[runtime] Role entrypoint . CALLING   OnStart()
[runtime] Role entrypoint . COMPLETED OnStart()
[runtime] Role entrypoint . CALLING   Run()
[WaWorkerHost.exe] java.exe is running...
[WaWorkerHost.exe] java.exe stopped running - exiting...
[WaWorkerHost.exe] 
[WaWorkerHost.exe] 
[WaWorkerHost.exe] Exited with error code 1.
[runtime] Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED
[runtime] Role instance recycling is starting
[runtime] Role entrypoint . CALLING   OnStop()
[runtime] Role entrypoint . COMPLETED OnStop()
[runtime] Role entrypoint . CALLING   OnStart()
[runtime] Role entrypoint . COMPLETED OnStart()
[runtime] Role entrypoint . CALLING   Run()
[WaWorkerHost.exe] java.exe is running...
[WaWorkerHost.exe] java.exe stopped running - exiting...
[WaWorkerHost.exe] 
[WaWorkerHost.exe] 
[WaWorkerHost.exe] Exited with error code 1.
[runtime] Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED
[runtime] Role instance recycling is starting
[runtime] Role entrypoint . CALLING   OnStop()
[runtime] Role entrypoint . COMPLETED OnStop()
[fabric] Role state Stopping
[fabric] Role state Busy
[fabric] Role state Started
[runtime] Role entrypoint . CALLING   OnStart()
[runtime] Role entrypoint . COMPLETED OnStart()
[runtime] Role entrypoint . CALLING   Run()
[WaWorkerHost.exe] java.exe is running...
[fabric] Role state Stopping
[WaWorkerHost.exe] java.exe stopped running - exiting...
[WaWorkerHost.exe] 
[WaWorkerHost.exe] 
[WaWorkerHost.exe] Exited with error code 1.
[runtime] Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED
[runtime] Role instance recycling is starting
[runtime] Role entrypoint . CALLING   OnStop()
[runtime] Role entrypoint . COMPLETED OnStop()
[fabric] Role state Busy
[fabric] Role state Started
[runtime] Role entrypoint . CALLING   OnStart()
[runtime] Role entrypoint . COMPLETED OnStart()
[runtime] Role entrypoint . CALLING   Run()
[WaWorkerHost.exe] java.exe is running...
[WaWorkerHost.exe] java.exe stopped running - exiting...
[WaWorkerHost.exe] 
[WaWorkerHost.exe] 
[WaWorkerHost.exe] Exited with error code 1.
[runtime] Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED
[runtime] Role instance recycling is starting
[fabric] Role state Stopping
[runtime] Role entrypoint . CALLING   OnStop()
[runtime] Role entrypoint . COMPLETED OnStop()
[fabric] Role state Busy
[fabric] Role state Started
[runtime] Role entrypoint . CALLING   OnStart()
[runtime] Role entrypoint . COMPLETED OnStart()
[runtime] Role entrypoint . CALLING   Run()
[WaWorkerHost.exe] java.exe is running...
[WaWorkerHost.exe] java.exe stopped running - exiting...
[WaWorkerHost.exe] 
[WaWorkerHost.exe] 
[WaWorkerHost.exe] Exited with error code 1.
[runtime] Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED
[runtime] Role instance recycling is starting
[fabric] Role state Stopping

我在 Windows 8(32 位)、JDK 7 和 Tomcat 7 上使用 Eclipse for Java EE (Juno)。

谢谢你的帮助。

4

1 回答 1

1

根据您遇到的错误,您的 Tomcat 部署似乎有问题。以下错误尤其明显: [WaWorkerHost.exe] java.exe is running... [WaWorkerHost.exe] java.exe 停止运行 - 正在退出...

这表明 Tomcat 确实设法运行了几秒钟,但随后由于某种原因退出,这导致重新启动(无限期,因为每当启动失败时,Azure 都会继续尝试重新启动)。

如果你已经确定你已经正确地遵循了这些步骤,那么你会想到的另一件事是,Tomcat 可能正试图绑定到你的 PC 上的某个东西已经占用的端口。默认情况下,Tomcat 会尝试绑定到 8080,因此如果您没有更改它,那么需要检查的一件事是您的 PC 上是否还有其他东西已经绑定到 8080。(模拟器不会为您的部署。您在机器上运行的其他东西可能会破坏模拟器中的东西)

但这只是一种预感。如果您还可以查看 Tomcat 报告的错误,那就太好了。您应该 - 如果只是短暂地 - 看到 Tomcat 弹出一个控制台窗口 - 其中报告了 Tomcat 的错误。如果您可以在此处提供更多信息,那可能会有所帮助。

于 2013-03-20T00:11:17.297 回答