1

我使用 maven 创建了一个项目,其“布局”如下 - proj-ear - module1-war - module2-war

使用“mvn appengine:devserver”运行它就可以了,两个应用程序/模块都启动并显示在管理控制台中。但是,我无法使用“mvn gcloud:run”运行它(如果/当我想将模块移动到托管虚拟机时,我认为这是必要的?)

我得到:...

[INFO] INFO: Starting API server at: `http://localhost:50500`

[INFO] INFO: Starting module "module1" running at: `http://localhost:8080`

[INFO] INFO: Applying all pending transactions and saving the datastore

...

[INFO] google.appengine.tools.devappserver2.wsgi_server.BindError: Unable to bind localhost:8081

[ERROR] Error: gcloud app xxx exit code is: 1

...

使用 mvn:run 最终会调用实际的“gcloud preview app run”命令,所以我不认为这是一个 maven 问题。

为什么会发生这种情况以及如何解决的任何想法?

4

1 回答 1

0

This is a common family of error when running servers on a computer. The error is coming from the wsgi_server code, which is attempting to open a socket on port 8081, I assume for module2. It fails, probably due to the port already being claimed by another process.

You can check which processes are listening on these ports using commands netstat for windows or lsof -i for linux/mac. Terminating any processes that are using ports your devserver will request (probably just a previous run of devserver) should allow the new devserver to bind on that port.

于 2015-01-02T20:35:24.050 回答