当我检查我的tomcat状态时会发生错误。如何在ubuntu服务器中解决此问题?
sudo systemctl status tomcat
tomcat.service - Apache Tomcat Web Application Container
Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2018-03-22 05:53:07 UTC; 1h 32min ago
Main PID: 20422 (java)
Tasks: 21
Memory: 1.0G
CPU: 36.353s
CGroup: /system.slice/tomcat.service
└─20422 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties -Djava.util.logging.m
Mar 22 05:53:07 ip-172-31-41-119 systemd[1]: Stopped Apache Tomcat Web Application Container.
Mar 22 05:53:07 ip-172-31-41-119 systemd[1]: tomcat.service: Unit entered failed state.
Mar 22 05:53:07 ip-172-31-41-119 systemd[1]: tomcat.service: Failed with result 'exit-code'.
Mar 22 05:53:07 ip-172-31-41-119 systemd[1]: Starting Apache Tomcat Web Application Container...
Mar 22 05:53:07 ip-172-31-41-119 startup.sh[20410]: export JAVA_OPTS -Djava.awt.headless=true -server -Xms500m -Xmx1536M -XX:MaxPermSize=512m
Mar 22 05:53:07 ip-172-31-41-119 startup.sh[20410]: Tomcat started.
Mar 22 05:53:07 ip-172-31-41-119 systemd[1]: Started Apache Tomcat Web Application Container.
Mar 22 06:01:53 ip-172-31-41-119 systemd[1]: Started Apache Tomcat Web Application Container.
...skipping...
● tomcat.service - Apache Tomcat Web Application Container
Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2018-03-22 05:53:07 UTC; 1h 32min ago
Main PID: 20422 (java)
Tasks: 21
Memory: 1.0G
CPU: 36.353s
CGroup: /system.slice/tomcat.service
└─20422 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties -Djava.util.logging.m
Mar 22 05:53:07 ip-172-31-41-119 systemd[1]: Stopped Apache Tomcat Web Application Container.
Mar 22 05:53:07 ip-172-31-41-119 systemd[1]: tomcat.service: Unit entered failed state.
Mar 22 05:53:07 ip-172-31-41-119 systemd[1]: tomcat.service: Failed with result 'exit-code'.
Mar 22 05:53:07 ip-172-31-41-119 systemd[1]: Starting Apache Tomcat Web Application Container...
Mar 22 05:53:07 ip-172-31-41-119 startup.sh[20410]: export JAVA_OPTS -Djava.awt.headless=true -server -Xms500m -Xmx1536M -XX:MaxPermSize=512m
Mar 22 05:53:07 ip-172-31-41-119 startup.sh[20410]: Tomcat started.
Mar 22 05:53:07 ip-172-31-41-119 systemd[1]: Started Apache Tomcat Web Application Container.
Mar 22 06:01:53 ip-172-31-41-119 systemd[1]: Started Apache Tomcat Web Application Container.
apache.service 文件
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target
[Service]
Type=forking
Environment=JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh
User=root
Group=root
UMask=0007
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
错误DruidDataSource:2453 - 创建连接SQLException,url:jdbc:mysql://xx.xx.xx.xx:3306 / mydb?autoReconnect = true& useSSL = false& useUnicode = yes& characterEncoding = UTF-8, errorCode 0,状态08001 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:无法创建与数据库服务器的连接。尝试重新连接3次。放弃。 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)