Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd, 2017 please sign up again. Thanks!

  1. More ways to get the info! - we shoot all of our new original content out as well as random messages on Twitter and our newsletter!. Twitter | Newsletter
    Dismiss Notice

Tomcat not work on CentOs - ExecStop=/bin/kill -15 $MAINPID (code=exited, status=1/FAILURE)

Discussion in 'Web Server' started by milan7, Feb 12, 2019.

  1. milan7

    milan7 New Member

    Joined:
    Feb 12, 2019
    Messages:
    4
    Likes Received:
    0
    Where do I make a mistake? Which log file I should looking for the problem? I write yet lot of forums but nobody can help...

    *(If I use tomcat 9.0.14 I have an error message in catalina.out: OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appr opriately using -XX:parallelGCThreads=N But this I can fix it with change in the 14.point config file(/etc/systemd/system/tomcat.service ) this one:

    -XX:parallelGCThreads=N
    for this: -XX:-AssumeMP Because I use virtual server on Digital Ocean and I have one processor.)*

    BUT it's not needed if I use Tomcat 8.5.37

    So I use now this step by step...

    0.

    [[email protected] ~]# java -version
    openjdk version "1.8.0_191"
    OpenJDK Runtime Environment (build 1.8.0_191-b12)
    OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
    1.

    wget http://xenia.sote.hu/ftp/mirrors/ww...cat-8/v8.5.37/bin/apache-tomcat-8.5.37.tar.gz
    2.

    tar xzf apache-tomcat-8.5.37.tar.gz
    3.

    mv apache-tomcat-8.5.37/ /opt/tomcat
    4.

    groupadd tomcat
    5.

    useradd -g tomcat -M -d /opt/tomcat -s /bin/nologin tomcat
    6.

    chgrp -R tomcat /opt/tomcat/
    7.

    chmod -R g+r /opt/tomcat/conf
    8.

    chmod -R g+x /opt/tomcat/conf
    9.

    chown -R tomcat /opt/tomcat/webapps/
    10.

    chown -R tomcat /opt/tomcat/work/
    11.

    chown -R tomcat /opt/tomcat/temp/
    12.

    chown -R tomcat /opt/tomcat/logs/
    13.

    vi /etc/systemd/system/tomcat.service
    14.

    # Systemd unit file for tomcat
    [Unit]
    Description=Apache Tomcat Web Application Container
    After=syslog.target network.target

    [Service]
    Type=forking


    (Log in to hide this advertisement)


    Environment=JAVA_HOME=/usr/lib/jvm/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=/bin/kill -15 $MAINPID

    User=tomcat
    Group=tomcat
    UMask=0007
    RestartSec=10
    Restart=always

    [Install]
    WantedBy=multi-user.target
    15.

    systemctl daemon-reload
    16.

    systemctl start tomcat
    17.

    systemctl status tomcat
    1. Error:

      tomcat.service - Apache Tomcat Web Application Container Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: dis abled) Active: activating (auto-restart) (Result: exit-code) since Fri 2019-02-08 07:3 7:49 UTC; 1s ago Process: 3198 ExecStop=/bin/kill -15 $MAINPID (code=exited, status=1/FAILURE) Process: 3185 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=0/SUCCES S) Main PID: 3196 (code=exited, status=0/SUCCESS)

      Feb 08 07:37:49 centos-s-1vcpu-1gb-ams3-01 systemd[1]: Unit tomcat.service ente... Feb 08 07:37:49 centos-s-1vcpu-1gb-ams3-01 systemd[1]: tomcat.service failed. Hint: Some lines were ellipsized, use -l to show in full.
     
  2. Rob

    Rob Administrator
    Staff Member

    Joined:
    Oct 27, 2011
    Messages:
    430
    Likes Received:
    919
    You'll want to dig around in /var/log/httpd (or maybe /var/log/tomcat) to look for the error messages on why it stopped.

    This is definitely on you and not digitalocean. They just provide the server, there's a misconfiguration of the software you've installed.
     
  3. milan7

    milan7 New Member

    Joined:
    Feb 12, 2019
    Messages:
    4
    Likes Received:
    0
    Hello!
    Thank you. But I follow step by step Digital Ocean and lot of other guide(very similar) This is the reason I write here also. So I haven't misconfiguration or I don't know. But where? Where should I looking for my mistake? Thank you

    [[email protected] ~]# cd /var/log
    [[email protected] log]# ls -l
    total 26768
    drwxr-xr-x. 2 root root 219 May 16 2018 anaconda
    drwx------. 2 root root 80 Feb 12 10:29 audit
    -rw-r--r--. 1 root root 121 Feb 4 13:03 boot.log
    -rw-------. 1 root utmp 3100416 Feb 12 13:31 btmp
    drwxr-xr-x. 2 chrony chrony 6 Apr 12 2018 chrony
    -rw-------. 1 root root 665301 Feb 12 06:43 cloud-init.log
    -rw-r--r--. 1 root root 5936 Feb 12 13:01 cron
    -rw-r--r--. 1 root root 94401 Feb 11 08:14 cron-20190211
    -rw-r--r--. 1 root root 32948 Feb 12 06:43 dmesg
    -rw-r--r--. 1 root root 33004 Feb 11 07:38 dmesg.old
    -rw-------. 1 root root 4137 Feb 4 14:24 grubby
    -rw-r--r--. 1 root root 489 Feb 4 14:21 grubby_prune_debug
    -rw-r--r--. 1 root root 292584 Feb 12 12:59 lastlog
    -rw-------. 1 root root 232 Feb 12 06:43 maillog
    -rw-------. 1 root root 279049 Feb 11 07:38 maillog-20190211
    -rw-------. 1 root root 10495607 Feb 12 13:31 messages
    -rw-------. 1 root root 7487241 Feb 11 08:13 messages-20190211
    drwxr-xr-x. 2 root root 6 Oct 30 21:29 qemu-ga
    drwxr-xr-x. 2 root root 6 May 16 2018 rhsm
    -rw-------. 1 root root 2289917 Feb 12 13:31 secure
    -rw-------. 1 root root 1570264 Feb 11 08:13 secure-20190211
    -rw-------. 1 root root 0 Feb 11 08:14 spooler
    -rw-------. 1 root root 0 May 16 2018 spooler-20190211
    -rw-------. 1 root root 0 May 16 2018 tallylog
    drwxr-xr-x. 2 root root 23 Nov 5 01:23 tuned
    -rw-rw-r--. 1 root utmp 32256 Feb 12 12:59 wtmp
    -rw-------. 1 root root 20684 Feb 7 09:27 yum.log
    [[email protected] log]#
     
  4. Rob

    Rob Administrator
    Staff Member

    Joined:
    Oct 27, 2011
    Messages:
    430
    Likes Received:
    919
    I'd start in messages.. if there are no tomcat logs there, then look through the conf files in /opt/tomcat to see if you can find where it's logging. If it's not, then you'll want to look up how to get tomcat to log to a file that you specify..
     
  5. milan7

    milan7 New Member

    Joined:
    Feb 12, 2019
    Messages:
    4
    Likes Received:
    0
    The tomcat logs contain the only one file that I mentioned before and also dismiss if i use tomcat 8.5.37. So where should I looking for the answer? Thank you
    [[email protected] tomcat]# ls -l
    total 124
    drwxr-x---. 2 root tomcat 4096 Feb 8 07:17 bin
    -rw-r-----. 1 root tomcat 19539 Dec 12 12:23 BUILDING.txt
    drwxr-x---. 2 root tomcat 238 Dec 12 12:23 conf
    -rw-r-----. 1 root tomcat 6090 Dec 12 12:23 CONTRIBUTING.md
    drwxr-x---. 2 root tomcat 4096 Feb 8 07:17 lib
    -rw-r-----. 1 root tomcat 57092 Dec 12 12:23 LICENSE
    drwxr-x---. 2 tomcat tomcat 26 Feb 8 08:34 logs
    -rw-r-----. 1 root tomcat 1726 Dec 12 12:23 NOTICE
    -rw-r-----. 1 root tomcat 3255 Dec 12 12:23 README.md
    -rw-r-----. 1 root tomcat 7142 Dec 12 12:23 RELEASE-NOTES
    -rw-r-----. 1 root tomcat 16262 Dec 12 12:23 RUNNING.txt
    drwxr-x---. 2 tomcat tomcat 48 Feb 12 13:42 temp
    drwxr-x---. 7 tomcat tomcat 81 Dec 12 12:07 webapps
    drwxr-x---. 2 tomcat tomcat 6 Dec 12 12:07 work
    [[email protected] tomcat]# cd logs/
    [[email protected] logs]# ls -l
    total 0
    -rw-r-----. 1 tomcat tomcat 0 Feb 12 13:42 catalina.out
     
  6. milan7

    milan7 New Member

    Joined:
    Feb 12, 2019
    Messages:
    4
    Likes Received:
    0
    So what should I looking for???
    [[email protected] tomcat]# cd /opt/tomcat/conf/
    [[email protected] conf]# ls -l
    total 224
    -rw-r-x---. 1 root tomcat 13548 Dec 12 12:23 catalina.policy
    -rw-r-x---. 1 root tomcat 7746 Dec 12 12:23 catalina.properties
    -rw-r-x---. 1 root tomcat 1338 Dec 12 12:23 context.xml
    -rw-r-x---. 1 root tomcat 1149 Dec 12 12:23 jaspic-providers.xml
    -rw-r-x---. 1 root tomcat 2313 Dec 12 12:23 jaspic-providers.xsd
    -rw-r-x---. 1 root tomcat 3916 Dec 12 12:23 logging.properties
    -rw-r-x---. 1 root tomcat 7511 Dec 12 12:23 server.xml
    -rw-r-x---. 1 root tomcat 2164 Dec 12 12:23 tomcat-users.xml
    -rw-r-x---. 1 root tomcat 2633 Dec 12 12:23 tomcat-users.xsd
    -rw-r-x---. 1 root tomcat 169322 Dec 12 12:23 web.xml
    [[email protected] conf]# vi c
    catalina.policy catalina.properties context.xml
    [[email protected] conf]# vi catalina.policy
    [[email protected] conf]# vi logging.properties
    [[email protected] conf]# vi logging.properties
    1 # Licensed to the Apache Software Foundation (ASF) under one or more
    2 # contributor license agreements. See the NOTICE file distributed with
    3 # this work for additional information regarding copyright ownership.
    4 # The ASF licenses this file to You under the Apache License, Version 2.0
    5 # (the "License"); you may not use this file except in compliance with
    6 # the License. You may obtain a copy of the License at
    7 #
    8 # http://www.apache.org/licenses/LICENSE-2.0
    9 #
    10 # Unless required by applicable law or agreed to in writing, software
    11 # distributed under the License is distributed on an "AS IS" BASIS,
    12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13 # See the License for the specific language governing permissions and
    14 # limitations under the License.
    15
    16 handlers = 1catalina.org.apache.juli.AsyncFileHandler, 2localhost.org.apache.juli.AsyncFileHandler, 3manager.org.apache.juli.AsyncFileHandler, 4host-manager.org .apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
    17
    18 .handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
    19
    20 ############################################################
    ############################################################
    21 # Handler specific properties.
    22 # Describes specific configuration info for Handlers.
    23 ############################################################
    24
    25 1catalina.org.apache.juli.AsyncFileHandler.level = FINE
    26 1catalina.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
    27 1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.
    28 1catalina.org.apache.juli.AsyncFileHandler.encoding = UTF-8
    29
    30 2localhost.org.apache.juli.AsyncFileHandler.level = FINE
    31 2localhost.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
    32 2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.
    33 2localhost.org.apache.juli.AsyncFileHandler.encoding = UTF-8
    34
    35 3manager.org.apache.juli.AsyncFileHandler.level = FINE
    36 3manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
    37 3manager.org.apache.juli.AsyncFileHandler.prefix = manager.
    38 3manager.org.apache.juli.AsyncFileHandler.encoding = UTF-8
    39
    40 4host-manager.org.apache.juli.AsyncFileHandler.level = FINE
    41 4host-manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
    42 4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.
    43 4host-manager.org.apache.juli.AsyncFileHandler.encoding = UTF-8
    44
    45 java.util.logging.ConsoleHandler.level = FINE
    46 java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter
    47 java.util.logging.ConsoleHandler.encoding = UTF-8
    48
    49
    50 ############################################################
    51 # Facility specific properties.
    52 # Provides extra control for each logger.
    53 ############################################################
    54
    55 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
    56 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.AsyncFileHandler
    57
    58 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
    59 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.AsyncFileHandler
    60
    61 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
    62 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.AsyncFileHandler
    63
    64 # For example, set the org.apache.catalina.util.LifecycleBase logger to log
    65 # each component that extends LifecycleBase changing state:
    66 #org.apache.catalina.util.LifecycleBase.level = FINE
    67
    68 # To see debug messages in TldLocationsCache, uncomment the following line:
    69 #org.apache.jasper.compiler.TldLocationsCache.level = FINE
    70
    71 # To see debug messages for HTTP/2 handling, uncomment the following line:
    72 #org.apache.coyote.http2.level = FINE
    73
    74 # To see debug messages for WebSocket handling, uncomment the following line:
    75 #org.apache.tomcat.websocket.level = FINE
     

Share This Page