我正在尝试使用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)。
感谢您的帮助。
答案 0 :(得分:1)
根据您获得的错误,您的Tomcat部署似乎有问题。以下错误尤其具有以下意义: [WaWorkerHost.exe] java.exe正在运行... [WaWorkerHost.exe] java.exe停止运行 - 退出...
这表明Tomcat确实设法运行了几秒钟,但由于某种原因导致重启(导致重启(无限期,因为无论何时启动时出现故障,Azure都会继续尝试重启)。
如果你已经确定你已经正确地遵循了这些步骤,那么另外一个想到的事情是,Tomcat可能正在尝试绑定到已经被PC上某些东西占用的端口。默认情况下,Tomcat尝试绑定到8080,所以如果你没有改变它,那么要检查的一件事是你的PC上还有其他东西已经绑定到8080.(模拟器没有创建一个完全自包含的沙箱您的部署。您在计算机上运行的其他内容可能会破坏模拟器中的内容)
但这只是一种预感。如果您还能看到Tomcat报告的错误,那就太好了。您应该 - 如果只是简单地 - 看到Tomcat弹出控制台窗口 - 其中报告了Tomcat的错误。如果您可以在此处提供更多信息,那可能有所帮助。