java.net.BindException:地址已在 tomcat 中使用
java.net.BindException: Address already in use in tomcat
我在 tomcat8.5
中尝试部署 Web 应用程序时收到错误消息
war文件放在CATALINA_BASE:ea-tomcat85/webapps/ROOT.war
我已经尝试了一些步骤来解决错误,但没有成功。
第 1 步: 我在 port 8080
上终止进程 运行
#netstat -pant | grep "8080"
tcp6 0 0 :::8080 :::* LISTEN 511871/java
#kill 511871
重新启动tomcat但收到同样的错误,也
第 2 步: 将 application.properties
中的应用程序端口号更改为 server.port=5815
之类的内容。
还是一样的错误。
服务器配置如下
服务 server.xml
CATALINA_BASE
<Service name="Catalina">
<Connector port="10000" protocol="HTTP/1.1" connectionTimeout="20000" xpoweredBy="false"/>
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="false" deployOnStartup="false" deployXML="false">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b"/>
<Valve className="org.apache.catalina.valves.ErrorReportValve" showReport="false" showServerInfo="false"/>
</Host>
</Engine>
<Connector port="10001" protocol="AJP/1.3" xpoweredBy="false" secretRequired="false"/>
</Service>
服务 server.xml
CATALINA_HOME
<Service name="Catalina">
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
</Engine>
</Service>
setenv.sh
在 CATALINA_BASE
[root@xxx bin]# cat setenv.sh
# Your customizations can go here, for example, CATALINA_OPTS
# example from https://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source
# Trade some security for startup speed by using non-blocking entropy:
# CATALINA_OPTS="$CATALINA_OPTS -Djava.security.egd=file:/dev/./urandom"
JRE_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre
CATALINA_PID="$CATALINA_BASE/bin/catalina.pid"
# DO NOT EDIT THIS LINE OR ANYTHING BELOW THIS LINE
. /opt/cpanel/ea-tomcat85/bin/user-setenv.sh
[root@xxx bin]#
setenv.sh
在 CATALINA_HOME
[root@xxx bin]# cat setenv.sh
export CATALINA_OPTS="$CATALINA_OPTS -server -Dfile.encoding=UTF-8 -Xms128m -Xmx6248m"
export CATALINA_PID="$CATALINA_BASE/bin/catalina.pid"
export CATALINA_BASE="/home/wematanzania/ea-tomcat85"
JRE_HOME= "/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre"
[root@xxx bin]#
CATALINA_BASE: /logs/catalina.out
catalina.out
文件中的错误描述CATALINA_BASE: /logs/catalina.out
21-May-2021 06:05:10.723 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
21-May-2021 06:05:10.828 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-10000"]
21-May-2021 06:05:10.841 SEVERE [main] org.apache.catalina.core.StandardService.initInternal Failed to initialize connector [Connector[HTTP/1.1-10000]]
org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1076)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:552)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:846)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.startup.Catalina.load(Catalina.java:639)
at org.apache.catalina.startup.Catalina.load(Catalina.java:662)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:302)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:472)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:461)
at sun.nio.ch.Net.bind(Net.java:453)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:222)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1143)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.init(AbstractJsseEndpoint.java:222)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:599)
at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:80)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1074)
... 13 more
21-May-2021 06:05:10.844 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
21-May-2021 06:05:10.846 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
21-May-2021 06:05:10.861 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-127.0.0.1-10001"]
21-May-2021 06:05:10.862 SEVERE [main] org.apache.catalina.core.StandardService.initInternal Failed to initialize connector [Connector[AJP/1.3-10001]]
org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1076)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:552)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:846)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.startup.Catalina.load(Catalina.java:639)
at org.apache.catalina.startup.Catalina.load(Catalina.java:662)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:302)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:472)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:461)
at sun.nio.ch.Net.bind(Net.java:453)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:222)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1143)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.init(AbstractJsseEndpoint.java:222)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:599)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1074)
... 13 more
21-May-2021 06:05:10.862 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 981 ms
21-May-2021 06:05:10.898 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
21-May-2021 06:05:10.898 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/8.5.66]
21-May-2021 06:05:10.910 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
21-May-2021 06:05:10.924 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 61 ms
更新:端口 10000 和 10001
[root@xxx logs]# netstat -pant | grep "10000"
tcp6 0 0 :::10000 :::* LISTEN 503271/java
[root@xxx logs]# netstat -pant | grep "10001"
tcp6 0 0 127.0.0.1:10001 :::* LISTEN 503271/java
[root@xxx logs]#
同样在启动时 tomcat 我收到以下输出。
[root@xxx bin]# ./startup.sh
/opt/cpanel/ea-tomcat85/bin/setenv.sh: line 4: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre: Is a directory
Using CATALINA_BASE: /home/profile/ea-tomcat85
Using CATALINA_HOME: /opt/cpanel/ea-tomcat85
Using CATALINA_TMPDIR: /home/profile/ea-tomcat85/temp
Using JRE_HOME: /
Using CLASSPATH: /opt/cpanel/ea-tomcat85/bin/bootstrap.jar:/opt/cpanel/ea-tomcat85/bin/tomcat-juli.jar
Using CATALINA_OPTS: -server -Dfile.encoding=UTF-8 -Xms128m -Xmx6248m
Using CATALINA_PID: /opt/cpanel/ea-tomcat85/bin/catalina.pid
Tomcat started.
我不确定 JRE_HOME: /
是否一定要那样。但是路径在两个 setenv.sh
文件
中都设置了
更新: 注释掉端口 10000 和 10001 上的连接器后,并将 application.properties
中 tomcat 的端口更改回 server.port=8080
我从浏览器收到以下错误
Catalina.out 在 CATALINA_BASE 中:logs/catalina.out
21-May-2021 11:18:09.524 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/8.5.66
21-May-2021 11:18:09.526 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: May 8 2021 22:44:01 UTC
21-May-2021 11:18:09.526 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 8.5.66.0
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.10.0-1127.19.1.el7.x86_64
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_292-b10
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Red Hat, Inc.
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /home/profile/ea-tomcat85
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /opt/cpanel/ea-tomcat85
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/home/profile/ea-tomcat85/conf/logging.properties
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dfile.encoding=UTF-8
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms128m
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx6248m
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
21-May-2021 11:18:09.529 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/home/profile/ea-tomcat85
21-May-2021 11:18:09.529 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/cpanel/ea-tomcat85
21-May-2021 11:18:09.529 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/home/profile/ea-tomcat85/temp
21-May-2021 11:18:09.529 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
21-May-2021 11:18:09.617 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
21-May-2021 11:18:09.631 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
21-May-2021 11:18:09.654 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 664 ms
21-May-2021 11:18:09.690 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
21-May-2021 11:18:09.701 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/8.5.66]
21-May-2021 11:18:09.711 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
21-May-2021 11:18:09.722 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 68 ms
并且 ROOT.war 不会在 CATALINA_BASE : /home/profile/ea-tomcat85/webapps/ROOT.war
中解压
这是我第一次在实时 tomcat 服务器上部署 war 文件,我已经阅读了很多关于此的 post,但我仍然不知道我到底是什么做 wrong.Kindly 协助。提前致谢。
java.net.BindException: 已通过上面提供的方案以及评论的帮助解决。
但是Internal Server Error
是由于[=23=的服务器配置中缺少模块 setEnv
造成的].将该模块添加到服务器,我可以无错误地访问该应用程序。
我在 tomcat8.5
中尝试部署 Web 应用程序时收到错误消息war文件放在CATALINA_BASE:ea-tomcat85/webapps/ROOT.war
我已经尝试了一些步骤来解决错误,但没有成功。
第 1 步: 我在 port 8080
#netstat -pant | grep "8080"
tcp6 0 0 :::8080 :::* LISTEN 511871/java
#kill 511871
重新启动tomcat但收到同样的错误,也
第 2 步: 将 application.properties
中的应用程序端口号更改为 server.port=5815
之类的内容。
还是一样的错误。
服务器配置如下
服务 server.xml
CATALINA_BASE
<Service name="Catalina">
<Connector port="10000" protocol="HTTP/1.1" connectionTimeout="20000" xpoweredBy="false"/>
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="false" deployOnStartup="false" deployXML="false">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b"/>
<Valve className="org.apache.catalina.valves.ErrorReportValve" showReport="false" showServerInfo="false"/>
</Host>
</Engine>
<Connector port="10001" protocol="AJP/1.3" xpoweredBy="false" secretRequired="false"/>
</Service>
服务 server.xml
CATALINA_HOME
<Service name="Catalina">
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
</Engine>
</Service>
setenv.sh
在 CATALINA_BASE
[root@xxx bin]# cat setenv.sh
# Your customizations can go here, for example, CATALINA_OPTS
# example from https://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source
# Trade some security for startup speed by using non-blocking entropy:
# CATALINA_OPTS="$CATALINA_OPTS -Djava.security.egd=file:/dev/./urandom"
JRE_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre
CATALINA_PID="$CATALINA_BASE/bin/catalina.pid"
# DO NOT EDIT THIS LINE OR ANYTHING BELOW THIS LINE
. /opt/cpanel/ea-tomcat85/bin/user-setenv.sh
[root@xxx bin]#
setenv.sh
在 CATALINA_HOME
[root@xxx bin]# cat setenv.sh
export CATALINA_OPTS="$CATALINA_OPTS -server -Dfile.encoding=UTF-8 -Xms128m -Xmx6248m"
export CATALINA_PID="$CATALINA_BASE/bin/catalina.pid"
export CATALINA_BASE="/home/wematanzania/ea-tomcat85"
JRE_HOME= "/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre"
[root@xxx bin]#
CATALINA_BASE: /logs/catalina.out
catalina.out
文件中的错误描述CATALINA_BASE: /logs/catalina.out
21-May-2021 06:05:10.723 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
21-May-2021 06:05:10.828 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-10000"]
21-May-2021 06:05:10.841 SEVERE [main] org.apache.catalina.core.StandardService.initInternal Failed to initialize connector [Connector[HTTP/1.1-10000]]
org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1076)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:552)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:846)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.startup.Catalina.load(Catalina.java:639)
at org.apache.catalina.startup.Catalina.load(Catalina.java:662)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:302)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:472)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:461)
at sun.nio.ch.Net.bind(Net.java:453)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:222)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1143)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.init(AbstractJsseEndpoint.java:222)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:599)
at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:80)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1074)
... 13 more
21-May-2021 06:05:10.844 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
21-May-2021 06:05:10.846 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
21-May-2021 06:05:10.861 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-127.0.0.1-10001"]
21-May-2021 06:05:10.862 SEVERE [main] org.apache.catalina.core.StandardService.initInternal Failed to initialize connector [Connector[AJP/1.3-10001]]
org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1076)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:552)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:846)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.startup.Catalina.load(Catalina.java:639)
at org.apache.catalina.startup.Catalina.load(Catalina.java:662)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:302)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:472)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:461)
at sun.nio.ch.Net.bind(Net.java:453)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:222)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1143)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.init(AbstractJsseEndpoint.java:222)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:599)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1074)
... 13 more
21-May-2021 06:05:10.862 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 981 ms
21-May-2021 06:05:10.898 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
21-May-2021 06:05:10.898 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/8.5.66]
21-May-2021 06:05:10.910 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
21-May-2021 06:05:10.924 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 61 ms
更新:端口 10000 和 10001
[root@xxx logs]# netstat -pant | grep "10000"
tcp6 0 0 :::10000 :::* LISTEN 503271/java
[root@xxx logs]# netstat -pant | grep "10001"
tcp6 0 0 127.0.0.1:10001 :::* LISTEN 503271/java
[root@xxx logs]#
同样在启动时 tomcat 我收到以下输出。
[root@xxx bin]# ./startup.sh
/opt/cpanel/ea-tomcat85/bin/setenv.sh: line 4: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre: Is a directory
Using CATALINA_BASE: /home/profile/ea-tomcat85
Using CATALINA_HOME: /opt/cpanel/ea-tomcat85
Using CATALINA_TMPDIR: /home/profile/ea-tomcat85/temp
Using JRE_HOME: /
Using CLASSPATH: /opt/cpanel/ea-tomcat85/bin/bootstrap.jar:/opt/cpanel/ea-tomcat85/bin/tomcat-juli.jar
Using CATALINA_OPTS: -server -Dfile.encoding=UTF-8 -Xms128m -Xmx6248m
Using CATALINA_PID: /opt/cpanel/ea-tomcat85/bin/catalina.pid
Tomcat started.
我不确定 JRE_HOME: /
是否一定要那样。但是路径在两个 setenv.sh
文件
更新: 注释掉端口 10000 和 10001 上的连接器后,并将 application.properties
中 tomcat 的端口更改回 server.port=8080
我从浏览器收到以下错误
Catalina.out 在 CATALINA_BASE 中:logs/catalina.out
21-May-2021 11:18:09.524 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/8.5.66
21-May-2021 11:18:09.526 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: May 8 2021 22:44:01 UTC
21-May-2021 11:18:09.526 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 8.5.66.0
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.10.0-1127.19.1.el7.x86_64
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_292-b10
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Red Hat, Inc.
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /home/profile/ea-tomcat85
21-May-2021 11:18:09.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /opt/cpanel/ea-tomcat85
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/home/profile/ea-tomcat85/conf/logging.properties
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dfile.encoding=UTF-8
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms128m
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx6248m
21-May-2021 11:18:09.528 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
21-May-2021 11:18:09.529 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/home/profile/ea-tomcat85
21-May-2021 11:18:09.529 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/cpanel/ea-tomcat85
21-May-2021 11:18:09.529 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/home/profile/ea-tomcat85/temp
21-May-2021 11:18:09.529 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
21-May-2021 11:18:09.617 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
21-May-2021 11:18:09.631 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
21-May-2021 11:18:09.654 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 664 ms
21-May-2021 11:18:09.690 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
21-May-2021 11:18:09.701 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/8.5.66]
21-May-2021 11:18:09.711 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
21-May-2021 11:18:09.722 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 68 ms
并且 ROOT.war 不会在 CATALINA_BASE : /home/profile/ea-tomcat85/webapps/ROOT.war
这是我第一次在实时 tomcat 服务器上部署 war 文件,我已经阅读了很多关于此的 post,但我仍然不知道我到底是什么做 wrong.Kindly 协助。提前致谢。
java.net.BindException: 已通过上面提供的方案以及评论的帮助解决。
但是Internal Server Error
是由于[=23=的服务器配置中缺少模块 setEnv
造成的].将该模块添加到服务器,我可以无错误地访问该应用程序。