更改 Google App Engine 的地址端口 - Eclipse

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18848532/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 21:11:26  来源:igfitidea点击:

changing the address port of Google App Engine - Eclipse

eclipsegoogle-app-engine

提问by rzqr

Is it possible to change the port address (8888) of Google App Engine ? If yes, how do I to change the port address ?

是否可以更改 Google App Engine 的端口地址(8888)?如果是,我该如何更改端口地址?

IDE :Eclipse 4.3

IDE :Eclipse 4.3

Because I always got when I try to debug my webapp :

因为当我尝试调试我的 webapp 时总是得到:

Could not open the requested socket: Address already in use: bind

无法打开请求的套接字:地址已在使用:绑定

Thanks in advance.

提前致谢。

回答by Philipp Gayret

From the documentation. You can add the argument ( under Run configurations --> Arguments )

文档中。您可以添加参数(在运行配置 --> 参数下)

--port=1234

Now when the address is in use you have something either already running on that port, which usually is another instance of GAE, make sure to close all running instances from the eclipse console, then try again. Or just check whats using the default port by going there in a browser.

现在,当地址正在使用时,您已经在该端口上运行了一些东西,这通常是 GAE 的另一个实例,请确保从 eclipse 控制台关闭所有正在运行的实例,然后重试。或者只是通过在浏览器中访问默认端口来检查使用默认端口的内容。

回答by Khalid

In case of Maven build you need to change the "pom.xml" file.

在 Maven 构建的情况下,您需要更改“pom.xml”文件。

(Ref.: https://cloud.google.com/appengine/docs/java/tools/maven#specifying_a_port_for_local_testing)

(参考:https: //cloud.google.com/appengine/docs/java/tools/maven#specifying_a_port_for_local_testing

find out the block like:

找出块,如:

<plugin>
     <groupId>com.google.appengine</groupId>
     <artifactId>appengine-maven-plugin</artifactId>
     <version>1.9.15</version>
     <configuration>
         <enableJarClasses>false</enableJarClasses>
         <port>8181</port>
         <address>0.0.0.0</address>
     </configuration>
</plugin>

and if there is no "<port...</port>"tag try to add one like above and change the port no. (in my case i change it to 8181) as you desire.

如果没有"<port...</port>"标签,请尝试添加上面的标签并更改端口号。(在我的情况下,我将其更改为 8181),如您所愿。

回答by u91

  • Go to pom.xml file in your maven project.
  • search for the tag < port > ( normally in maven projects it comes as < port > 8080 < /port--> as a comment in the following piece of code or similar to that
  • 转到 maven 项目中的 pom.xml 文件。
  • 搜索标签<端口>(通常在maven项目中它作为<端口> 8080</port-->作为以下代码段或类似的注释

< plugin >
     < groupId >com.google.appengine< /groupId >
     < artifactId >appengine-maven-plugin< /artifactId >
     < version >1.9.4< /version >
     < configuration >
          < enableJarClasses >false< /enableJarClasses >
          < !-- address>0.0.0.0< /address >
          < port >8080< /port -- >
          < port >1234< /port > //**add your port here with < port > tags...**
     < /configuration >
< /plugin >

).

)。

  • save pom.xml file.
  • 保存 pom.xml 文件。

回答by rolling stone

If the port is unused intentionally and still if you are unable to claim that port then and abnormal termination of the service is causing the issue. So to fix it.

如果端口是故意未使用的,并且您仍然无法声明该端口,则服务的异常终止是导致问题的原因。所以要修复它。

You have to kill the process.

你必须终止进程。

--->Go to command/terminal
--->type ps java (Shows the process for java)
---> then check the particular process to kill it or use (killall -9 java).

回答by Sander Descamps

In Eclipse, the easiest way to run the server on a different port is by creating a new App Engine Server instance. In the wizard you can select the port number you want.

在 Eclipse 中,在不同端口上运行服务器的最简单方法是创建一个新的 App Engine 服务器实例。在向导中,您可以选择所需的端口号。

回答by Marce

If you are running GWT devmode under a Web Application (if you are working with Eclipse and GWT Plugin) go to your configuration then "Arguments" (tab) > "Program Arguments" and add the port option

如果您在 Web 应用程序下运行 GWT devmode(如果您正在使用 Eclipse 和 GWT 插件)转到您的配置然后“参数”(选项卡)>“程序参数”并添加端口选项

for example you must have something like this .....-codeServerPort 9997.... just add -port 8080 (if you want to use port 80 for example), then just run or debug as usual

例如你必须有这样的东西 .....-codeServerPort 9997 .... 只需添加 -port 8080(例如,如果你想使用端口 80),然后像往常一样运行或调试

The best configuration maybe is:

最好的配置可能是:

(For eclipse users) I don't know why but -port dissapear from the configuration, so then instead of changing port by for example -port 8080, you must instead set "-startupUrl 127.0.0.1:8080/MyWebApp";, notice I set here port 8080 so next time I run my config on Eclipse it will work fine without adding "-port" again and again. – Marce 1 min ago

(对于eclipse用户)我不知道为什么但是-port从配置中消失了,所以不是通过例如-port 8080更改端口,而是必须设置“-startupUrl 127.0.0.1:8080/MyWebApp”;,注意我在这里设置了端口 8080,所以下次我在 Eclipse 上运行我的配置时,它可以正常工作,而无需一次又一次地添加“-port”。– Marce 1 分钟前

回答by Amit Chaudhary

if this is the problem arose in running app inventor offline in browser then i think i have the solution, this could also help for other purpose. so just follow the steps below.(for windows user) step 1:open cmd window and type "netstat -aon". you will see list of local address along with PID. for app inventor offline 8888 is the local address, so i concern with 8888 port address and note the PID number . step 2: now open task manager and click on detail tab. then locate the pid number that is noted for that port address and end the service associated with that pid number.now your port is free to use localhost:8888 to launch app inventor in offline.

如果这是在浏览器中离线运行应用程序发明者时出现的问题,那么我想我有解决方案,这也可以用于其他目的。所以只需按照以下步骤操作。(对于 Windows 用户)步骤 1:打开 cmd 窗口并输入“netstat -aon”。您将看到本地地址列表和 PID。对于应用程序发明者离线 8888 是本地地址,所以我关心 8888 端口地址并注意 PID 号。第 2 步:现在打开任务管理器并单击详细信息选项卡。然后找到为该端口地址记录的 pid 号并结束与该 pid 号关联的服务。现在您的端口可以自由地使用 localhost:8888 离线启动应用程序发明者。