I want to launch the Tomcat service on CentOS with the cmdlet :
systemctl start tomcat.service
but i get the error
Failed to start Apache ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=203/EXEC).
and the log through the command :
Journalctl -xe
is stating that
Selinux is preventing (artup.sh) from execute access on the file startup.sh
given that i can start any other service on my CentOS what could be the problem for my tomcat service ?
Thank you
The SELinux restricts binaries that can be used in ExecStart to paths that has system_u:object_r:bin_t:s0 attribute set. Typically those are /usr/bin /usr/sbin /usr/libexec /usr/local/bin directories.
You need to move the script into one of this directories or change selinux policy to allow systemd to use binaries in the desired location as:
A restorecon will 'unfix' the above better to update the policy e.g.
UPDATE
If java binary is not located in the standard location (custom JVM distribution), then you need to set bin_t label to it as well. For example, it your JVM installed in /opt/java, then:
NOTICE: systemd ignores JAVA_HOME environment variable if it's not set in unit file.