[systemd-devel] Failed to start Apache Tomcat Web Application Container

Mark Huggins mark.huggins315 at gmail.com
Tue Jul 24 15:03:10 UTC 2018


Hello All:

I'm attempting to install Apache Tomcat 8.5.32 onto a Centos 7.5 VM via
Chef Software.

My VM(s) are created and managed by VirtualBox and Vagrant. There are no
issues creating any of the VM(s).

What is an issue is when I execute a "kitchen converge" from the Chef
Workstation which I have set to load the tomcat::default recipe
(default.rb).

>From there the recipe chimes along to the point of executing the
'sudo systemctl daemon-reload' as noted below from the excerpt of the
tomcat::default recipe.
*execute 'daemon-reload' do*
*  command 'sudo systemctl daemon-reload'*
*end*

The execution within the tomcat::default recipe is to start the tomcat
service:
*service "tomcat" do*
*  action :start*
*end*

This is where I receive the error with respect of the tomcat service
failing but as I peel back the onion through "*systemctl status
tomcat.service*" and "*journalctl -xe*" for details once logged into the VM
(*kitchen login*) it appears the real issue is with the tomcat service
remains in an "*auto-restart state*" which leads to "*tomcat.service:
control process exited, code=exited status=1*", "*Failed to start Apache
Tomcat Web Application Container", "Unit tomcat.service entered failed
state" *and* "tomcat.service failed.*"

I believe since my *tomcat.service.erb* template is not able to create via
the "touch" command a file called ‘*/opt/tomcat/logs/catalina.out*’:
*Permission
denied* detailed from the "*journalctl -xe*" output.

For testing pursposes, I issued "*sudo touch *
*/opt/tomcat/logs/catalina.out*" command on the VM that created the emptied
file and re-ran "*kitchen converge*" from the chef workstation. The same
results and error output occurred although the VM now has the ‘
*/opt/tomcat/logs/catalina.out'* file.

*Question*:
Is there way to modify the template file: *tomcat.service.erb* to include
creating ‘*/opt/tomcat/logs/catalina.out*' file prior to execution of the
*'sudo systemctl daemon-reload'*command? Also, I'm unsure how long  the
command: *'sudo systemctl daemon-reload'  *takes and perhaps is a causing
the failed state of the tomcat.service since it times out?. If there's
another resolution to this issue or the path I'm leading towards is the
wrong direction, please advise.

The instructions that I'm following can be found in an article titled: "*How
To Install Apache Tomcat 8 on CentOS 7*"
* https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-centos-7
<https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-centos-7>*

*Please refer to the section: "**Install Systemd Unit File"*

Any assistance will be well received and I'll be extremely appreciative.

Thank you to All!


*See "systemctl status tomcat.service" and "journalctl -xe" for details*

================================================================================
           Error executing action `start` on resource 'service[tomcat]'

 ================================================================================

           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           Expected process to exit with [0], but received '1'
           ---- Begin output of /bin/systemctl --system start tomcat ----
           STDOUT:
           STDERR: Job for tomcat.service failed because the control
process exited with error code. See "systemctl status tomcat.service" and
"journalctl -xe" for details.
           ---- End output of /bin/systemctl --system start tomcat ----
           Ran /bin/systemctl --system start tomcat returned 1

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/tomcat/recipes/default.rb

           124: service "tomcat" do
           125:   action :start
           126: end
           127:

           Compiled Resource:
           ------------------
           # Declared in
/tmp/kitchen/cache/cookbooks/tomcat/recipes/default.rb:124:in `from_file'

[vagrant at tomcat-centos-75 ~]$ *sudo systemctl status tomcat.service*
● tomcat.service - Apache Tomcat Web Application Container
*   Loaded: loaded (/etc/systemd/system/tomcat.service; disabled; vendor
preset: disabled)*
*   Active: activating (auto-restart) (Result: exit-code) since Tue
2018-07-24 13:59:08 UTC; 2s ago*
  Process: 5999 ExecStart=/opt/tomcat/bin/startup.sh (code=exited,
status=1/FAILURE)

Jul 24 13:59:08 tomcat-centos-75.vagrantup.com systemd[1]: *tomcat.service:
control process exited, code=exited status=1*
Jul 24 13:59:08 tomcat-centos-75.vagrantup.com systemd[1]: *Failed to start
Apache Tomcat Web Application Container.*
Jul 24 13:59:08 tomcat-centos-75.vagrantup.com systemd[1]: *Unit
tomcat.service entered failed state.*
Jul 24 13:59:08 tomcat-centos-75.vagrantup.com systemd[1]: *tomcat.service
failed.*
[vagrant at tomcat-centos-75 ~]$
[vagrant at tomcat-centos-75 ~]$
[vagrant at tomcat-centos-75 ~]$* sudo journalctl -xe*
-- The result is failed.
Jul 24 13:59:28 tomcat-centos-75.vagrantup.com systemd[1]: *Unit
tomcat.service entered failed state.*
Jul 24 13:59:28 tomcat-centos-75.vagrantup.com systemd[1]: *tomcat.service
failed*.
Jul 24 13:59:38 tomcat-centos-75.vagrantup.com systemd[1]: *tomcat.service
holdoff time over, scheduling restart.*
Jul 24 13:59:38 tomcat-centos-75.vagrantup.com systemd[1]: *Starting Apache
Tomcat Web Application Container...*
-- Subject: Unit tomcat.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit tomcat.service has begun starting up.
Jul 24 13:59:39 tomcat-centos-75.vagrantup.com startup.sh[6025]: *touch:
cannot touch ‘/opt/tomcat/logs/catalina.out’: Permission denied*
Jul 24 13:59:39 tomcat-centos-75.vagrantup.com systemd[1]: *tomcat.service:
control process exited, code=exited status=1*
Jul 24 13:59:39 tomcat-centos-75.vagrantup.com startup.sh[6025]:
*/opt/tomcat/bin/catalina.sh:
line 464: /opt/tomcat/logs/catalina.out: Permission denied*
Jul 24 13:59:39 tomcat-centos-75.vagrantup.com systemd[1]: *Failed to start
Apache Tomcat Web Application Container.*
-- Subject: Unit tomcat.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
*-- Unit tomcat.service has failed.*
--
-- The result is failed.
Jul 24 13:59:39 tomcat-centos-75.vagrantup.com systemd[1]: *Unit
tomcat.service entered failed state.*
Jul 24 13:59:39 tomcat-centos-75.vagrantup.com systemd[1]: *tomcat.service
failed.*
Jul 24 13:59:45 tomcat-centos-75.vagrantup.com sudo[6033]:  vagrant :
TTY=pts/0 ; PWD=/home/vagrant ; USER=root ; COMMAND=/bin/journalctl -xe
lines 2749-2772/2772 (END)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180724/92cd6472/attachment-0001.html>


More information about the systemd-devel mailing list