我在 Ubuntu 18.04
我“apt 安装”了 tomcat8,它运行良好……直到我搞乱了配置。所以我“apt 删除”了它,并手动删除了文件夹/usr/share/tomcat8
和/var/lib/tomcat7
。
然后我重新安装了它...
sudo apt install tomcat8-admin
sudo apt install tomcat8
但是当我这样做来启动它时......
sudo /etc/init.d/tomcat8 start
我明白了......
[....] Starting tomcat8 (via systemctl): tomcat8.serviceJob for tomcat8.service failed because the control process exited with error code.
See "systemctl status tomcat8.service" and "journalctl -xe" for details.
failed!
当我做 ...
sudo journalctl -xe
... 它说...“tomcat8 未安装”和“tomcat8.service:失败,结果为‘退出代码’”和“单元 tomcat8.service 失败”
我该如何重新安装 tomcat8 和/或弄清楚它无法启动的原因?
完整输出sudo journalctl -xe
如下:
-- Unit tomcat8.service has begun starting up.
Sep 17 17:04:53 ip-172-31-27-106 tomcat8[20746]: * tomcat8 is not installed
Sep 17 17:04:53 ip-172-31-27-106 systemd[1]: tomcat8.service: Control process exited, code=exited status=1
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' resumed (module 'builtin:omfile') [v8.32.0 try http://www.rsyslog.com/e/2359 ]
Sep 17 17:04:53 ip-172-31-27-106 systemd[1]: tomcat8.service: Failed with result 'exit-code'.
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' suspended (module 'builtin:omfile'), retry 0. There should be messages before this one giving the reason for suspe
Sep 17 17:04:53 ip-172-31-27-106 systemd[1]: Failed to start LSB: Start Tomcat..
-- Subject: Unit tomcat8.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit tomcat8.service has failed.
--
-- The result is RESULT.
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' resumed (module 'builtin:omfile') [v8.32.0 try http://www.rsyslog.com/e/2359 ]
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' suspended (module 'builtin:omfile'), retry 0. There should be messages before this one giving the reason for suspe
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' resumed (module 'builtin:omfile') [v8.32.0 try http://www.rsyslog.com/e/2359 ]
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' suspended (module 'builtin:omfile'), retry 0. There should be messages before this one giving the reason for suspe
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' resumed (module 'builtin:omfile') [v8.32.0 try http://www.rsyslog.com/e/2359 ]
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' suspended (module 'builtin:omfile'), retry 0. There should be messages before this one giving the reason for suspe
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' resumed (module 'builtin:omfile') [v8.32.0 try http://www.rsyslog.com/e/2359 ]
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' suspended (module 'builtin:omfile'), retry 0. There should be messages before this one giving the reason for suspe
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' resumed (module 'builtin:omfile') [v8.32.0 try http://www.rsyslog.com/e/2359 ]
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' suspended (module 'builtin:omfile'), retry 0. There should be messages before this one giving the reason for suspe
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' resumed (module 'builtin:omfile') [v8.32.0 try http://www.rsyslog.com/e/2359 ]
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' suspended (module 'builtin:omfile'), retry 0. There should be messages before this one giving the reason for suspe
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' resumed (module 'builtin:omfile') [v8.32.0 try http://www.rsyslog.com/e/2359 ]
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' suspended (module 'builtin:omfile'), retry 0. There should be messages before this one giving the reason for suspe
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' resumed (module 'builtin:omfile') [v8.32.0 try http://www.rsyslog.com/e/2359 ]
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' suspended (module 'builtin:omfile'), retry 0. There should be messages before this one giving the reason for suspe
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' resumed (module 'builtin:omfile') [v8.32.0 try http://www.rsyslog.com/e/2359 ]
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' suspended (module 'builtin:omfile'), retry 0. There should be messages before this one giving the reason for suspe
Sep 17 17:04:53 ip-172-31-27-106 rsyslogd[20535]: action 'action 8' suspended (module 'builtin:omfile'), next retry is Thu Sep 17 17:05:23 2020, retry nbr 0. There should be messages
Sep 17 17:04:53 ip-172-31-27-106 sudo[20734]: pam_unix(sudo:session): session closed for user root
Sep 17 17:08:06 ip-172-31-27-106 sshd[20780]: Connection closed by authenticating user root 45.227.255.204 port 51400 [preauth]
Sep 17 17:08:34 ip-172-31-27-106 sudo[20783]: ubuntu : TTY=pts/0 ; PWD=/var/log/tomcat8 ; USER=root ; COMMAND=/bin/journalctl -xe
Sep 17 17:08:34 ip-172-31-27-106 sudo[20783]: pam_unix(sudo:session): session opened for user root by ubuntu(uid=0)
答案1
尝试运行
tail -f /var/log/tomcat8/catalina.out
当你重新启动 tomcat 时。我发现,
root@stage-damageid4:~# tail -f /var/log/tomcat8/catalina.out
# Native memory allocation (mmap) failed to map 2110586880 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /tmp/hs_err_pid2714.log
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=2096m; support was removed in 8.0
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000742330000, 2110586880, 0) failed; error='Cannot allocate memory' (errno=12)
这意味着我为 JVM 指定了太多内存。