You might try adding "RemainAfterExit=yes"  to your service definition (in
the Service block). Also, try looking at the journald logs for catalina and
systemd; they might give you more clues as to what is happening (sudo
journalctl -t systemd and sudo journalctl -t catalina).

On Mon, Dec 20, 2021 at 6:09 AM Pietro Maria Liuzzo <
pietro.liu...@uni-hamburg.de> wrote:

> Dear all,
>
> sorry, I rarely work with tomcat, now I upgraded from 9 to 10 and I am
> having troubles even before putting my .war applications in, I hope someone
> can point me to my mistake.
>
> I have installed tomcat with brew on Ubuntu 18. It was installed in
> /home/linuxbrew/.linuxbrew/Cellar/tomcat/10.0.14/ beside the previous
> version 9, which got cleared of its contents beside libexec.
>
> I then went on to modify my server.xml with port 8081 instead of 8080,
> where I have another application running.
>
> I changed owner to tomcat:tomcat to the directory
> /home/linuxbrew/.linuxbrew/Cellar/tomcat
>
> then I went on to my tomcat.service and modified like this (for the
> version number)
>
> [Unit]
> Description=Tomcat 10 servlet container
> After=network.target
>
> [Service]
> Type=forking
>
>
> Environment=JAVA_HOME=/usr/lib/jvm/default-java
> Environment=JRE_HOME=/home/linuxbrew/.linuxbrew/opt/openjdk
> Environment=JAVA_OPTS="-Djava.security.egd=file:///dev/urandom
> <file:///dev/urandom> -Djava.awt.headless=true"
>
>
> Environment=CATALINA_BASE=/home/linuxbrew/.linuxbrew/Cellar/tomcat/10.0.14/libexec
>
> Environment=CATALINA_HOME=/home/linuxbrew/.linuxbrew/Cellar/tomcat/10.0.14/libexec
>
> Environment=CATALINA_PID=/home/linuxbrew/.linuxbrew/Cellar/tomcat/10.0.14/libexec/temp/tomcat.pid
> Environment=CATALINA_OPTS="-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
>
> ExecStart=/home/linuxbrew/.linuxbrew/Cellar/tomcat/10.0.14/bin/catalina
> start
> ExecStop=/home/linuxbrew/.linuxbrew/Cellar/tomcat/10.0.14/bin/catalina stop
>
> User=tomcat
> Group=tomcat
>
> [Install]
> WantedBy=multi-user.target
>
>
> If I start with bin/catalina start
>
> I get
> Using CATALINA_BASE:
>  /home/linuxbrew/.linuxbrew/Cellar/tomcat/10.0.14/libexec
> Using CATALINA_HOME:
>  /home/linuxbrew/.linuxbrew/Cellar/tomcat/10.0.14/libexec
> Using CATALINA_TMPDIR:
> /home/linuxbrew/.linuxbrew/Cellar/tomcat/10.0.14/libexec/temp
> Using JRE_HOME:        /usr/lib/jvm/default-java
> Using CLASSPATH:
>  
> /home/linuxbrew/.linuxbrew/Cellar/tomcat/10.0.14/libexec/bin/bootstrap.jar:/home/linuxbrew/.linuxbrew/Cellar/tomcat/10.0.14/libexec/bin/tomcat-juli.jar
> Using CATALINA_OPTS:
> Tomcat started.
>
> If I start with sudo systemctl start tomcat and then I test with systemctl
> status tomcat I get
>
> tomcat.service - Tomcat 10 servlet container
>    Loaded: loaded (/etc/systemd/system/tomcat.service; disabled; vendor
> preset: enabled)
>    Active: failed (Result: exit-code) since Mon 2021-12-20 13:44:26 CET;
> 4s ago
>   Process: 7592
> ExecStart=/home/linuxbrew/.linuxbrew/Cellar/tomcat/10.0.14/bin/catalina
> start (code=exited, status=0/SU
>  Main PID: 7612 (code=exited, status=1/FAILURE)
>
> Dec 20 13:44:26 betamasaheft2 systemd[1]: Starting Tomcat 10 servlet
> container...
> Dec 20 13:44:26 betamasaheft2 catalina[7592]: Existing PID file found
> during start.
> Dec 20 13:44:26 betamasaheft2 catalina[7592]: Removing/clearing stale PID
> file.
> Dec 20 13:44:26 betamasaheft2 catalina[7592]: Tomcat started.
> Dec 20 13:44:26 betamasaheft2 systemd[1]: Started Tomcat 10 servlet
> container.
> Dec 20 13:44:26 betamasaheft2 systemd[1]: tomcat.service: Main process
> exited, code=exited, status=1/FAILURE
> Dec 20 13:44:26 betamasaheft2 systemd[1]: tomcat.service: Failed with
> result 'exit-code'.
>
> the log in catalina.2021-12-20.log tells me
>
> 20-Dec-2021 13:34:17.081 INFO [main]
> org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
> ["http-nio-8081"]
> 20-Dec-2021 13:34:17.103 INFO [main]
> org.apache.catalina.startup.Catalina.start Server startup in [2513]
> milliseconds
> 20-Dec-2021 13:35:21.613 INFO [main]
> org.apache.catalina.core.StandardServer.await A valid shutdown command was
> received via the shutdown port. Stopping the Server instance.
> 20-Dec-2021 13:35:21.614 INFO [main]
> org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler
> ["http-nio-8081"]
> 20-Dec-2021 13:35:21.625 INFO [main]
> org.apache.catalina.core.StandardService.stopInternal Stopping service
> [Catalina]
> 20-Dec-2021 13:35:21.702 INFO [main]
> org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler
> ["http-nio-8081"]
> 20-Dec-2021 13:35:21.711 INFO [main]
> org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler
> ["http-nio-8081“]
>
>
> Which to me looks like „I started, and then I shut down“. I do not
> understand where is the button which the hand clicks to close it self once
> it has been triggered out to the box. It feels to me like I have changed
> and tried with every combination of quotes, lines included and excluded,
> changes of port and reassigning of premissions.
>
> Thanks a lot for any help you can give me.
>
> all best
>
> Pietro
>
> Pietro Maria Liuzzo (egli/lui,he/him,er/ihn)
> Hiob Ludolf Centre for Ethiopian Studies
> Room: 136
> Alsterterrasse 1
> 20354 Hamburg
> Tel: +49 40 42838-8381
> ORCID: https://orcid.org/0000-0001-5714-4011
> Academia: https://uni-hamburg.academia.edu/PietroMariaLiuzzo
>
>

-- 
Noelette Stout
ITS Enterprise Applications - Senior Application Administrator
Idaho State University
E-mail: stounoel "at" isu "dot" edu
Desk: 208-282-2554

Reply via email to