Tomcat 未启动:tomcat.service:控制进程已退出,代码=退出状态=1 [英] Tomcat not starting : tomcat.service: Control process exited, code=exited status=1

查看:54
本文介绍了Tomcat 未启动:tomcat.service:控制进程已退出,代码=退出状态=1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我面临的错误信息

我已经安装了 tomcat8.我删除了它,然后我再次尝试安装 tomcat8,但面临这个问题,我无法再次安装 tomcat.我在安装之前遵循的步骤列表 -

I had tomcat8 already installed. i removed that and then i tried installing tomcat8 again but facing this issue and i am not able to install tomcat again. List of Steps i followed before Installing -

  1. sudo apt-get 删除 tomcat8
  2. sudo apt-get remove --auto-remove tomcat8
  3. sudo apt-get purge tomcat8
  4. sudo apt-get purge --auto-remove tomcat8

现在我从这里安装了新的 tomcat8 - https://websiteforstudents.com/setup-apache-tomcat-8-8-5-on-ubuntu-16-04-18-04-lts/

Now i have installed new tomcat8 from here - https://websiteforstudents.com/setup-apache-tomcat-8-8-5-on-ubuntu-16-04-18-04-lts/

出现错误 - 上面附有图片

and getting error - image attached above

推荐答案

首先,如果您使用的是 Debian 或 Ubuntu,请使用 tomcat8/tomcat9 软件包(参见 packages.ubuntu.com) 是运行 Tomcat 服务器的最简单方法.

First of all, if you are using Debian or Ubuntu, using the tomcat8/tomcat9 packages (cf. packages.ubuntu.com) is the easiest way to run a Tomcat server.

在您的情况下,tomcat.service 文件缺少 PIDFile 选项,有助于以可靠的方式确定 Tomcat 正在运行.因此,我会修改您的 tomcat.service 脚本以包含:

In your case the tomcat.service file lacks a PIDFile option, which helps determining in a reliable way that Tomcat is running. Therefore I would modify your tomcat.service script to contain:

[Service]
# ...
# The rest of the options
PIDFile="/run/tomcat.pid"
Environment="CATALINA_PID=/run/tomcat.pid"

在启动服务之前,请确保您的 Tomcat 没有运行(killall java 或其他更微妙的东西)并记住重新加载 SystemD 守护进程:

Before starting the service make sure that your Tomcat is not running (killall java or something more subtle) and remember to reload the SystemD daemon:

systemctl daemon-reload

修改后的tomcat.service文件应该是这样的:

After the modification the tomcat.service file should look like this:

[Unit]
Description=Tomcat servlet container
After=network.target

[Service]
Type=forking
User=tomcat
Group=tomcat
Environment="JAVA_HOME=/usr/lib/jvm/default-java"
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom"
Environment="CATALINA_HOME=/opt/tomcat"
Environment="CATALINA_PID=/run/tomcat.pid"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"

PIDFile="/run/tomcat.pid"

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

[Install]
WantedBy=multi-user.target

这篇关于Tomcat 未启动:tomcat.service:控制进程已退出,代码=退出状态=1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆