I have been struggling with an issue which resulted in the same message: "Service exit with a return value of 143".
In the end the problem was with a custom init script that was calling jsvc directly. I did not bother to find the precise root cause though. When I saw daemon.sh worked, I simply modified my init script to use it. daemon.sh is sensitive to many environment variables. Do you have some of these variables exported? I suggest to run deamon.sh from a "clean" shell. Define variables one by one as required and see if Tomcat finally starts correctly. 2015-07-24 6:53 GMT-04:00 Robert Jacobs <robertjacob...@gmail.com>: > On Fri, Jul 24, 2015 at 10:15 AM, Mark Eggers > <its_toas...@yahoo.com.invalid > > wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > On 7/24/2015 12:59 AM, Robert Jacobs wrote: > > > Hello, > > > > > > We are having problems getting tomcat to work with JSVC on RHEL 7.1 > > > (maipo). We found out that Tomcat restarts do not always result in > > > expected behaviour. The pattern of this unexpected behavior > > > (Service exit with a return value of 143) is random. This random > > > pattern might depend on the deploy-time of Tomcat during startup. > > > > > > The problem might lay within the daemon functionality using JSVC. > > > > > > We have tried this one two machines; - Fedora 20 desktop -> > > > everything works fine - RHEL 7.1 virtual machine -> random fails > > > > > > Tried versions of tomcat 8 include 18 and 24. > > > > > > We did see other people with this exact problem and error code, but > > > these problems existed for tomcat 5 to 7. We could not find > > > information regarding tomcat 8 yet. > > > > > > Our findings are as follows: systemctl start tomcat fail > > > (143) systemctl stop tomcat fail (143) systemctl restart > > > tomcat fail (143) etc/init.d/tomcat start pass > > > etc/init.d/tomcat stop pass etc/init.d/tomcat restart > > > fail (143)(note: combined stop/start) CATALINA_HOME/bin/daemon.sh > > > start pass CATALINA_HOME/bin/daemon.sh stop pass > > > > > > General note for all stop commands: Every time this "Server > > > startup" is not finished, each stop command results in the 143 > > > exit. > > > > > > The two methods of starting tomcat: init.d and systemctl are: > > > ###########init.d############ #!/bin/bash > > > > > > CATALINA_HOME="/opt/apache-tomcat/apache-tomcat-8.0.24" > > > > > > start() { sh $CATALINA_HOME/bin/daemon.sh start } stop() { sh > > > $CATALINA_HOME/bin/daemon.sh stop } > > > > > > case $1 in start|stop) $1;; restart) stop; start;; *) echo "Run as > > > $0 <start|stop|restart>"; exit 1;; esac ###########end of > > > init.d############ > > > > > > ###########systemctl############ [Unit] Description=Apache Tomcat > > > Server > > > > > > [Install] WantedBy=multi-user.target > > > > > > [Service] Type=oneshot > > > ExecStart=/opt/apache-tomcat/apache-tomcat-8.0.24/bin/daemon.sh > > > start > > > ExecStop=/opt/apache-tomcat/apache-tomcat-8.0.24/bin/daemon.sh > > > stop User=adsswebserver Group=adsswebserver ###########end of > > > systemctl############ > > > > > > Server version: Apache Tomcat/8.0.24 Server built: > > > Jul 1 2015 20:19:55 UTC Server number: 8.0.24.0 OS Name: > > > Linux OS Version: 3.10.0-229.7.2.el7.x86_64 > > > Architecture: amd64 Java Home: > > > /usr/java/jdk1.8.0_20/jre JVM Version: 1.8.0_20-b26 JVM > > > Vendor: Oracle Corporation CATALINA_BASE: > > > /opt/apache-tomcat/apache-tomcat-8.0.24 CATALINA_HOME: > > > /opt/apache-tomcat/apache-tomcat-8.0.24 Command line argument: > > > -Djava.util.logging.config.file=/opt/apache-tomcat/apache-tomcat-8.0.2 > > 4//conf/logging.properties > > > > > > > > Command line argument: > > > -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager > > > Command line argument: -Djava.endorsed.dirs= Command line > > > argument: -Dcatalina.base=/opt/apache-tomcat/apache-tomcat-8.0.24/ > > > Command line argument: > > > -Dcatalina.home=/opt/apache-tomcat/apache-tomcat-8.0.24 Command > > > line argument: > > > -Djava.io.tmpdir=/opt/apache-tomcat/apache-tomcat-8.0.24//temp > > > Command line argument: -Dcommons.daemon.process.id=13312 Command > > > line argument: -Dcommons.daemon.process.parent=13311 Command line > > > argument: -Dcommons.daemon.version=1.0.15-dev Command line > > > argument: abort > > > > > > Any advice would be appreciated. > > > > > > > A couple of quick notes, although it's early and I may be barking up > > the wrong tree. > > > > In your init.d script for restart, I don't see any wait time between > > the start and stop commands. Does daemon.sh stop return immediately, > > or does it not return until the Tomcat (jsvc) process is stopped? > > > > In your systemd script, I didn't see the following line under [Unit]: > > > > After=syslog.target network.target > > > > You may not need syslog.target, but I would suspect that you need > > network.target. > > > > . . . just my (1 AM) 2 cents > > /mde/ > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v2 > > > > iQEcBAEBAgAGBQJVsfQbAAoJEEFGbsYNeTwtRDoH/RJidKt4psPDe+mIzoKLclwK > > YxlE8JWLfb55+OWRukLjzp42n5CMzmw7jujQOgzJxb8XyP9pEYokKG1OdG1+Mubn > > b5JaZg/G0N6KHn7tzhwPD6CGs9lmnJhR7NKgu3K8ZYbu3Fjxi7OVEYf4G9F9VXIk > > x91P2C6n2Ky88XnHA0gVHfPZw4D+xRKxsw7dx4BAIhnmt2NfH/ea8Jdw7fzgHnSh > > fI1XpbtzNVkMrLvby07i784zzRaSa9JZjwuSF+nA+AuGMmb63wJf2TDoDMnKq5aP > > 8TFAsvUr8zGZNdz0QkdXElwHkzpDaOn9mj5ZHBJb9pu9v+B2f4N/9V/Rn0jnVt4= > > =FB1d > > -----END PGP SIGNATURE----- > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > > For additional commands, e-mail: users-h...@tomcat.apache.org > > > > > Hello, > > Thanks a lot for your (super) fast response! Highly appreciated! > > These are the outcomes regarding your mail; > > > > *In your systemd script, I didn't see the following line under > > [Unit]:After=syslog.target network.target* > > > We have added the line After=syslog.target network.target to tomcat.service > file. Same result (status code 143). > > > > *Does daemon.sh stop return immediately,or does it not return until the > > Tomcat (jsvc) process is stopped?* > > > It does return AFTER JSVC stopped. This was observed using two console > windows, one giving command to stop tomcat service and one watching ps for > the JSVC instance (0.1 seconds interval). > > We started the daemon.sh ourselves using > /opt/apache-tomcat/apache-tomcat-8.0.24/bin/daemon.sh start (pass) > We stopped the daemon.sh ourselves using > /opt/apache-tomcat/apache-tomcat-8.0.24/bin/daemon.sh stop > > Log of failing start: > > [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR > based Apache Tomcat Native library which allows optimal performance in > production environments was not found on the java.library.path: > > /usr/java/default/lib/amd64/server:/usr/java/default/lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib > [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler > ["http-nio-8080"] > [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a > shared selector for servlet write/read > [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler > ["ajp-nio-8009"] > [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a > shared selector for servlet write/read > [main] org.apache.catalina.startup.Catalina.load Initialization processed > in 598 ms > [main] org.apache.catalina.core.StandardService.startInternal Starting > service Catalina > [main] org.apache.catalina.core.StandardEngine.startInternal Starting > Servlet Engine: Apache Tomcat/8.0.24 > [localhost-startStop-1] > org.apache.catalina.startup.HostConfig.deployDirectory Deploying web > application directory /opt/apache-tomcat/apache-tomcat-8.0.24/webapps/ROOT > *Service exit with a return value of 143* > > > > > *In your init.d script for restart, I don't see any wait time betweenthe > > start and stop commands.* > > > Correct. We have tried with sleep 10 now as well. But that does not help > with the problem. We have found out that when we start tomcat using > init.d/tomcat start, there is an OK back to terminal, but tomcat has not > finished deploying webapps (see also 30 seconds ROOT deployment note below) > during server startup. On the next restart (which stops tomcat first), > tomcat has not finished server startup and then returns error 143, because > we stop it before it finished starting. > > > We have also noticed that startup of webapps/ROOT can take a long time. > See the log below for an example of a startup time > 30 seconds; > > 24-Jul-2015 11:53:47.459 INFO [localhost-startStop-1] > org.apache.catalina.startup.HostConfig.deployDirectory Deploying web > application directory /opt/apache-tomcat/apache-tomcat-8.0.24/webapps/ROOT > 24-Jul-2015 11:54:17.964 INFO [localhost-startStop-1] > org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation > of SecureRandom instance for session ID generation using [SHA1PRNG] took > [30,248] milliseconds. > 24-Jul-2015 11:54:17.986 INFO [localhost-startStop-1] > org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web > application directory /opt/apache-tomcat/apache-tomcat-8.0.24/webapps/ROOT > has finished in 30,527 ms > > > Thanks again! > > > > -- > Met vriendelijke groet / With kind regards, > Robert Jacobs > -- Philippe Anctil