本文介绍了Tomcat7 绑定到端口 80 在 Ubuntu 14.04LTS 中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在新更新的 Ubuntu 系统上安装 tomcat7 时遇到问题.自从更新到 14.04 LTS 后,tomcat 拒绝在端口 80 上启动,出现一个我无法解决的错误,也找不到任何关于如何修复它的信息:

I've got a problem with my tomcat7 installation on a newly updated Ubuntu system. Ever since the update to 14.04 LTS, tomcat refuses to start on port 80 with an error that I cannot solve, nor find anything on how to fix it:

    Information: Initializing ProtocolHandler ["http-bio-80"]
Apr 24, 2014 4:39:37 PM org.apache.coyote.AbstractProtocol init
Schwerwiegend: Failed to initialize end point associated with ProtocolHandler ["http-bio-80"]
java.net.SocketException: Datei oder Verzeichnis nicht gefunden
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
    at java.net.ServerSocket.bind(ServerSocket.java:376)
    at java.net.ServerSocket.<init>(ServerSocket.java:237)
    at java.net.ServerSocket.<init>(ServerSocket.java:181)
    at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
    at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:397)
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:640)
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:434)
    at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:978)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:813)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:638)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)

问题是,我已经完成了我在以前的 Ubuntu(运行 12.04 LTS)中所做的工作,简而言之,将 server.xml 编辑为端口 80,并将/etc/default/tomcat7 中的 authbind 更改为是的,所以基本上你需要做的所有事情都是在端口 80 上运行 tomcat.

The thing is, I've done exactly what I've done in previous Ubuntus (was running 12.04 LTS), in short, edited the server.xml to port 80 and also changed authbind in /etc/default/tomcat7 to yes, so basically everything you have to do to run tomcat on port 80.

在 12.04LTS 上执行这些步骤工作正常,只是在 14.04LTS 上它现在会抛出此找不到文件或目录"错误.

Doing those steps on a 12.04LTS works fine, just on the 14.04LTS it now throws this "file or directory not found" error.

此外,当将 12.04LTS(tomcat 在端口 80 上运行良好)升级到 14.04LTS 时,它突然抛出上述错误,而所有配置与 12.04LTS 中的配置相同.

Also when upgrading a 12.04LTS (on which tomcat runs fine on port 80) to 14.04LTS, it suddenly throws the error above, while all configuration are identical to what worked in 12.04LTS.

希望有人能帮我解决这个问题.

I hope anyone can help me fix this problem.

推荐答案

以下作品:

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

这里有一个参考 URL,但该网站已被黑(在 Edge 中标记为不安全,Chrome 提示我安装浏览器扩展).

这篇关于Tomcat7 绑定到端口 80 在 Ubuntu 14.04LTS 中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-30 11:22