![tomcat 无法在 ubuntu 服务器上启动](https://linux22.com/image/585624/tomcat%20%E6%97%A0%E6%B3%95%E5%9C%A8%20ubuntu%20%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E5%90%AF%E5%8A%A8.png)
2012 年 5 月 31 日更新
我有一个 VPS,并且运行 Tomcat 服务器一年多来没有出现问题。但是,Tomcat 在 VPS 维护后立即关闭,并且一周前无法重新启动。因此,我查看了 catalina.out,发现我的 VPS 缺少 Apache Tomcat Native 库:
root@cdou:/home/tomcat/logs# vim catalina.out May 28, 2012 8:32:02 AM
org.apache.catalina.core.AprLifecycleListener init INFO: The APR based
Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java.library.path:
/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-6-openjdk/jre/lib/amd64:/usr/lib/jvm/java-6-openjdk/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib/jni:/lib:/usr/lib
所以我在 google 上搜索并安装了 libtcnative-1,但仍然没有运气,现在 catalina.out 给我这个:
An older version 1.1.19 of the APR based Apache Tomcat Native library is installed, while Tomcat recommends a minimum version of 1.1.2
答案1
我会 :
- 查找配置的应用程序使用的任何特定侦听器
- 暂时禁用 iptables,以确保端口不会被阻止
- 查看是否有任何与 IP 的特定绑定。
- 手动启动 Tomcat(不是作为服务)并查看它在启动时引发的错误。
我希望这有帮助 。
答案2
本机库安装是一种优化,不会停止 tomcat 启动。
因此,警报消息仅记录在以下INFO
级别;
INFO: The APR based Apache Tomcat Native library which allows optimal performance
in production environments was not found
SEVERE
因此,您将在或级别寻找其他消息CRITICAL
:
您可以像这样搜索严重的启动错误;
# egrep "(SEVERE|WARN|CRIT|ERROR)" /var/log/tomcat6/catalina.out
SEVERE: The web application [/republish] appears to have started a thread named [Timer-1608] but has failed to stop it. This is very likely to create a memory leak.
SEVERE: The web application [/republish] appears to have started a thread named [Timer-1609] but has failed to stop it. This is very likely to create a memory leak.
要仔细检查状态,您可以运行netstat -lntp | grep :8080
以检查其是否正在监听;
# netstat -lntp | grep ":8080"
tcp 0 0 :::8080 :::* LISTEN 32195/java
还可以在进程列表中查找它;
# ps -ef | grep tomcat
root 20558 20374 0 13:39 pts/0 00:00:00 grep tomcat
tomcat 32195 1 1 May27 ? 00:56:16 /usr/lib/jvm/java/bin/java -Xmx1024M -Djava.awt.headless=true -XX:-HeapDumpOnOutOfMemoryError -classpath :/usr/share/tomcat6/bin/bootstrap.jar:/usr/share/tomcat6/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar -Dcatalina.base=/usr/share/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.endorsed.dirs= -Djava.io.tmpdir=/var/cache/tomcat6/temp -Djava.util.logging.config.file=/usr/share/tomcat6/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager org.apache.catalina.startup.Bootstrap start
如果您有端口 8080 正在监听,并且在输出中有条目ps -ef
,那么它已经经历了启动阶段,并且在端口 8080 上运行服务器。
如果您仍然没有任何信息,请发布在 tomcat6 启动阶段记录的 catalina.out 文件的其余部分。