端口为80的Tomcat连接器启动失败。

6

我运行的Web应用是 https://github.com/donhuvy/mycustomer,但遇到了错误。

描述:

配置为监听80端口的Tomcat连接器启动失败。该端口可能已被使用或连接器配置错误。

操作:

验证连接器的配置,识别并停止任何正在监听80端口的进程,或将此应用程序配置为侦听另一个端口。

这是我的日志文件 https://gist.github.com/donhuvy/93210850f955f9ddbc00ab735a0ade18#file-terminal-log-L191

我已经通过命令检查了80端口。

sudo lsof -i TCP:80 | grep LISTEN

但结果为空,怎么解决?(我使用macOS 10.12.5)
更新:
运行Sencha客户端(在目录client内)。
sencha web -port 8082 start

我将Spring Boot端口更改为8082:

APPLICATION FAILED TO START

Description:

The Tomcat connector configured to listen on port 8082 failed to start. The port may already be in use or the connector may be misconfigured.

Action:

Verify the connector's configuration, identify and stop any process that's listening on port 8082, or configure this application to listen on another port.

端口80上已经有运行的东西了吗?防火墙是否可能阻止您使用该端口? - Carl Shiles
我的 /etc/hosts 文件内容为:127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost - Raphaël Colantonio
正如我所说,我使用命令检查端口80,结果是没有任何东西。 - Raphaël Colantonio
首先将端口更改为其他端口并检查 - 如果可以工作,则80端口已被使用,请尝试找出是谁在使用它。如果不起作用,请检查其他配置,这不是端口的问题。 - ikos23
我尝试将Spring Boot的端口更改为8082,并运行Sencha客户端,但仍然出现相同的错误。 - Raphaël Colantonio
3个回答

10

在Linux中,只有root用户可以打开低于1024的端口,因此默认情况下限制了80端口。

如果您想在80端口上发布您的应用程序,您需要将请求从80端口重定向到您要运行springapp的端口(例如8080)。

您可以使用Apache2服务器,默认允许在80端口上工作,并可以为您转发请求到Tomcat。

来源:Spring Boot running app on port 80


4
这是通过“java.net.SocketException: Permission denied”指示的。如果另一个程序已经绑定到端口80(其他答案提供了这种建议),你将收到另一条错误消息,如“端口已被占用”。 顺便提一下,在macOS上,低于1024的端口也是同样工作的(正如问题中所提到的)。 - Ronald Klop
1
非常感谢。我在Manjaro中遇到了这个问题。 - Dan Ortega

0

80端口已被其他应用程序占用。更改Tomcat的端口号。您不能直接在80端口上运行Tomcat,需要安装authbind。有关参考,请参阅以下链接:

以下操作可行:

apt-get install authbind

首先,在/etc/default/tomcat7文件中设置AUTHBIND=yes

sudo touch /etc/authbind/byport/80
sudo chmod 500 /etc/authbind/byport/80
sudo chown tomcat7 /etc/authbind/byport/80

参考:http://georgik.sinusgear.com/2012/03/10/tomcat-7-listen-on-port-80-linux-debian/comment-page-1/

http://2ality.com/2010/07/running-tomcat-on-port-80-in-user.html


"post no of tomcat" 是什么意思? - naXa stands with Ukraine

0

如果您使用配置为80端口的SpringBoot应用程序,可能会出现两个问题:

  1. 需要以root权限执行命令。只需在启动命令之前添加“sudo”。这对我有帮助。

  2. 端口被另一个应用程序占用。要检查它,可以使用命令:“netstat -l”;


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接