如果我跑
sudo apt-get install tomcat8
我正进入(状态:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
libtcnative-1 tomcat8-admin tomcat8-docs tomcat8-examples tomcat8-user
The following NEW packages will be installed:
tomcat8
0 upgraded, 1 newly installed, 0 to remove and 161 not upgraded.
Need to get 0 B/41,9 kB of archives.
After this operation, 306 kB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package tomcat8.
(Reading database ... 403872 files and directories currently installed.)
Preparing to unpack .../tomcat8_8.0.32-1ubuntu1.2_all.deb ...
Unpacking tomcat8 (8.0.32-1ubuntu1.2) ...
Processing triggers for systemd (229-4ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up tomcat8 (8.0.32-1ubuntu1.2) ...
Job for tomcat8.service failed because the control process exited with error code. See "systemctl status tomcat8.service" and "journalctl -xe" for details.
invoke-rc.d: initscript tomcat8, action "start" failed.
dpkg: error processing package tomcat8 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
tomcat8
E: Sub-process /usr/bin/dpkg returned an error code (1)
不知道问题是什么-有什么想法吗?
答案1
如何修复以下错误:
tomcat8.service 的作业失败,因为控制进程退出并显示错误代码。有关详细信息,请参阅“systemctl status tomcat8.service”和“journalctl -xe”。invoke-rc.d: initscript tomcat8,操作“start”失败。
$ sudo nano /etc/default/tomcat8
设置 JAVA_HOME -> 例如 JAVA_HOME=/usr/lib/jvm/java-8-oracle
就我而言:
JAVA_HOME=/usr/local/java/jdk1.8.0_151
如果您对 JAVA_HOME 常量没有任何概念:
echo $JAVA_HOME
感谢@alexislucena @https://gist.github.com/alexislucena/89a046dc747123faf4496fb946c1fe79
对我来说,问题是我用 Oracle 的官方 JDK(安装了新的 java jdk)替换了 LinuxMint 附带的 openJDK,并且显然 tomcat 配置为使用默认 JDK - 因此解决方案是将 tomcat 配置为使用新的 jdk。