how to run tomcat 8.0.53 unit systemd file opensuse 15.0

Hello!
How are you?

We need to run tomcat 8.0.53 in opensuse 15.0. One method that I did use in other opensuse (42.2) was: Install tomcat by opensuse package: zypper install tomcat . So, I did download tomcat 8.0.53 by tomcat website. I tested in terminal running ./startup.sh (from tomcat 8.0.53 /bin directory and our other config) and ok running. At **/etc/tomcat/tomcat.conf **I put the path about:

#Where your java installation lives
JAVA_HOME="/usr/libi64/jvm/jre-11"
# Where your tomcat installation lives
CATALINA_HOME="/usr/share/tomcat" (path from tomcat 8.0.53)

and ok,
Go to Yast - **services manager **- **tomcat **- **start boot **- **on boot **- **Save **-
In OPENSUE 42.2 it runs tomcat version 8.0.53 ok, nice and from boot

So, I did try the same config in Opensuse 15.0. In opensuse 15.0 in packages it installs tomcat 9. After put the paths at /etc/tomcat/tomcat.conf from tomcat 8.0.53
run the command:

systemctl tomcat start
systemctl tomcat status

and show me:

Nov 29 09:28:48 equiplanov server[14069]: See the Home Screen API documentation for more information�>
Nov 29 09:28:48 equiplanov server[14069]: @argument files
Nov 29 09:28:48 equiplanov server[14069]: One or more argument files containing options
Nov 29 09:28:48 equiplanov server[14069]: -disable-@files
Nov 29 09:28:48 equiplanov server[14069]: Prevents further expansion of argument file
Nov 29 09:28:48 equiplanov server[14069]: nTo specify an argument for a long option, you can use - <name> = <value> or
Nov 29 09:28:48 equiplanov server[14069]: --<name> <value>.
Nov 29 09:28:48 equiplanov systemd[1]: tomcat.service: Main process exited, code=exited, status=1/FAILURE
Nov 29 09:28:48 equiplanov systemd[1]: tomcat.service: Unit entered failed state.
Nov 29 09:28:48 equiplanov systemd[1]: tomcat.service: Failed with result ‘exit-code’.

So, please any Idea how to solve this

I can not install tomcat 9, for that app needs to be tomcat 8.0.53 version!

Thanks attention and help

Douglas

What is in the systemd unit file you created?

Hello

How are you?

the original unit file is:

Systemd unit file for default tomcat

To create clones of this service:

DO NOTHING, use tomcat@.service instead.

[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target

[Service]
TasksMax=576
LimitNOFILE=8192
Type=simple
EnvironmentFile=/etc/tomcat/tomcat.conf
Environment=“NAME=”
EnvironmentFile=-/etc/sysconfig/tomcat
ExecStart=/usr/lib/tomcat/server start
ExecStop=/usr/lib/tomcat/server stop
SuccessExitStatus=143
User=tomcat
Group=tomcat

[Install]
WantedBy=multi-user.target


This, I did configuration

cat tomcat@.service
[Unit]
Description=Apache Tomcat
After=syslog.target network.target

[Service]
Type=forking

User=tomcat

Group=tomcat

Environment=JAVA_HOME=/usr/lib64/jvm/java-11-openjdk-11/
Environment=CATALINA_PID=/srv/equiplano/sistemasequiplanoweb/tomcat/apache-tomcat-8.0.53/tomcat.pid
Environment=CATALINA_HOME=/srv/equiplano/sistemasequiplanoweb/tomcat/apache-tomcat-8.0.53
Environment=CATALINA_BASE=/srv/equiplano/sistemasequiplanoweb/tomcat/apache-tomcat-8.0.53

Environment=“CATALINA_OPTS=-Xms128M -Xmx765M -server -XX:+Paracelulose”

Environment=“JAVA_OPTS=-Djava.awt.haedless=true -Djava.security.egd=file:/dev/./urandom”

WorkingDirectory=/srv/equiplano/sistemasequiplanoweb/tomcat/apache-tomcat-8.0.53

ExecStart=/srv/equiplano/sistemasequiplanoweb/tomcat/apache-tomcat-8.0.53/bin/startup.sh
ExecStop=/srv/equiplano/sistemasequiplanoweb/tomcat/apache-tomcat-8.0.53/bin/shutdown.sh

User=tomcat
Group=tomcat

[Install]
WantedBy=multi-user.target

After, put java path and catalina path at /etc/tomcat/tomcat.conf

Thnaks

Any ideia, how to solve this?

Hello All

The steps to solve

1- I did install opensuse 15 as “new” installation
in terminal: zypper up

2 - Create tomcat group and user:
Group:

groupadd tomcat

create tomcat user and put it tomcat group

useradd tomcat -M -N -g tomcat

3 - Download tomcat 8.0.53:
cd /srv/opt

wget https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.53/bin/apache-tomcat-8.0.53.tar.gz 

4 - unpak the tar.gz

tar -xzvf apache....press tab

5 - cd to /bin apache directory

cd /srv/opt/apache-tomcat-8.0.53/bin

6 - create setenv.sh file

nano setenv.sh

7 - Put the JAVA_HOME path

JAVA_HOME="/usr/lib64/jvm/java-11-openjdk-11"

8 - Inside setenv.sh put your JAVA_OPTS for example:

export JAVA_OPTS=......

save file

9 - change the owner apache tomcat diretory

chown -R tomcat.tomcat apache-tomcat-8.0.53/

10 - Create tomcat.service unit in /usr/lib/systemd/system:

Description=Tomcat 8 service

After=syslog.target](http://about<strong></strong>:blank)network.target](http://network.target)

[Service]
Type=forking

User=tomcat
Group=tomcat

Environment="JAVA_HOME=/usr/lib64/jvm/java-11-openjdk-11/"
Environment="CATALINA_PID=/srv/opt/apache-tomcat-8.0.53/tomcat.pid"
Environment="CATALINA_HOME=[FONT=Arial]/srv/opt/apache-tomcat-8.0.53/"[/FONT]
Environment="CATALINA_BASE=[FONT=Arial]/srv/opt/apache-tomcat-8.0.53/"[/FONT]

ExecStart=[FONT=Arial]/srv/opt/apache-tomcat-8.0.53/bin/startup.sh[/FONT]
ExecStop=[FONT=Arial]/srv/opt/apache-tomcat-8.0.53/bin/shutdown.sh[/FONT]

[Install]
WantedBy=multi-user.target](http://about<strong></strong>:blank)

11 - Reload systemctl daemin

systemctl daemon-reload

12 - Start tomcat

systemctl start tomcat

13 - verify tomcat status

systemctl status tomcat

14 - stop tomcat

systemctl stop tomcat

15 - Enable service tomcat in boot

systemctl enable tomcat.service

16 - Go to yast - services manager - search for tomcat and verify if **Start mode is “On Boot”. **Change if need - press OK.

17 - Reboot the system

18 - After boot, open firefox and access: **localhost:8080
Tomcat webpage should appear

**Thank you!

Douglas

How are you?

We need to run tomcat 8.0.53 in opensuse 15.0. One method that I did use in other opensuse (42.2) was: Install tomcat by opensuse package: zypper install tomcat . So, I did download tomcat 8.0.53 by tomcat website. I tested in terminal running ./startup.sh (from tomcat 8.0.53 /bin directory and our other config) and ok running. At **/etc/tomcat/tomcat.conf **I put the path about:

#Where your java installation lives
JAVA_HOME="/usr/libi64/jvm/jre-11"
# Where your tomcat installation lives
CATALINA_HOME="/usr/share/tomcat" (path from tomcat 8.0.53)

and ok,
Go to Yast - **services manager **- **tomcat **- **start boot **- **on boot **- **Save **-
In OPENSUE 42.2 it runs tomcat version 8.0.53 ok, nice and from boot

So, I did try the same config in Opensuse 15.0. In opensuse 15.0 in packages it installs tomcat 9. After put the paths at /etc/tomcat/tomcat.conf from tomcat 8.0.53
run the command:

systemctl tomcat start
systemctl tomcat status

and show me:

Nov 29 09:28:48 equiplanov server[14069]: See the Home Screen API documentation for more information�>
Nov 29 09:28:48 equiplanov server[14069]: @argument files
Nov 29 09:28:48 equiplanov server[14069]: One or more argument files containing options
Nov 29 09:28:48 equiplanov server[14069]: -disable-@files
Nov 29 09:28:48 equiplanov server[14069]: Prevents further expansion of argument file
Nov 29 09:28:48 equiplanov server[14069]: nTo specify an argument for a long option, you can use - <name> = <value> or
Nov 29 09:28:48 equiplanov server[14069]: --<name> <value>.
Nov 29 09:28:48 equiplanov systemd[1]: tomcat.service: Main process exited, code=exited, status=1/FAILURE
Nov 29 09:28:48 equiplanov systemd[1]: tomcat.service: Unit entered failed state.
Nov 29 09:28:48 equiplanov systemd[1]: tomcat.service: Failed with result ‘exit-code’.

So, please any Idea how to solve this

I can not install tomcat 9, for that app needs to be tomcat 8.0.53 version!

Thanks attention and help

Douglas[/QUOTE]

Hi,
I think you misunderstood the instructions embedded in the original tomcat Unit file which suggested “if you want to clone the tomcat service” to create a new tomcat@.service Unit file…

I don’t know exactly how whoever wrote that comment chose those words, but AFAIK typically that described procedure creates spawned child instances of that one defined service. In a way that might suggest “cloning” is creating additional instances but I don’t know that’s a clear concept to a reader.

But,
I don’t think you were actually trying to create multiple instances of tomcat running side by side…
I think you were simply trying to create a customized single instance of tomcat…

If that is the case, then all you had to do was copy the Unit file to the location reserved for User customized versions of default Unit files, and then modify as desired

cp /usr/lib/systemd/system/tomcat.service /etc/systemd/system/tomcat.service

After the above,
You can make all the modifications you described in your successful effort, pointing to files, setting environmental values or anything else you please and your copy of the Unit file over-rides the default instance.
When/if you want to remove your personal, customized configuration, all you need to delete your copy and the default file will resume as the active configuration.

TSU