错误在`restart`上配置Tomcat Cookbook

时间:2014-04-26 00:15:45

标签: tomcat chef cookbook

使用test-kitchen时,我的配置/聚合在运行opscode / tomcat时失败 食谱(请见下文)。

.kitchen.yml

  'tomcat': {
    'keytool': '/usr/bin/keytool',
    'home': '/some/path/tomcat'
  },
================================================================================
?[31mError executing action `restart` on resource 'service[tomcat]'
================================================================================
?[36m

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '4'
---- Begin output of /sbin/service tomcat6 restart ----
STDOUT: Stopping tomcat6: [FAILED]
Starting tomcat6: [FAILED]
STDERR:
---- End output of /sbin/service tomcat6 restart ----
Ran /sbin/service tomcat6 restart returned 4


Resource Declaration:
---------------------
# In /tmp/kitchen/cookbooks/tomcat/recipes/default.rb
?[36m
178: service 'tomcat' do
179:   case node['platform']
180:   when 'centos', 'redhat', 'fedora', 'amazon'
181:     service_name "tomcat#{node['tomcat']['base_version']}"
182:     supports :restart => true, :status => true
183:   when 'debian', 'ubuntu'
184:     service_name "tomcat#{node['tomcat']['base_version']}"
185:     supports :restart => true, :reload => false, :status => true
186:   when 'smartos'
187:     service_name 'tomcat'
188:     supports :restart => false, :reload => false, :status => true
189:   else
190:     service_name "tomcat#{node['tomcat']['base_version']}"
191:   end
192:   action [:start, :enable]

?[36m

Compiled Resource:
------------------
# Declared in /tmp/kitchen/cookbooks/tomcat/recipes/default.rb:178:in `from_file'
?[36m
service("tomcat") do
  action [:start, :enable]
  updated true
  supports {:restart=>true, :status=>true}
  retries 0
  retry_delay 30
  guard_interpreter :default
  service_name "tomcat6"
  enabled true
  running true
  pattern "tomcat"
  cookbook_name :tomcat
  recipe_name "default"
end

?[36m

[2014-04-25T22:13:08+00:00] INFO: template[/etc/sysconfig/clock] sending run action to bash[tzdata-update] (d
elayed)
Recipe: timezone-ii::rhel
  * bash[tzdata-update] action run[2014-04-25T22:13:08+00:00] INFO: Processing bash[tzdata-update] action
 run (timezone-ii::rhel line 18)
[2014-04-25T18:13:08-04:00] INFO: bash[tzdata-update] ran successfully
?[32m
    - execute "bash"  "/tmp/chef-script20140425-2850-37csx9"

?[36m
Running handlers:
[2014-04-25T18:13:08-04:00] ERROR: Running exception handlers
Running handlers complete

[2014-04-25T18:13:08-04:00] ERROR: Exception handlers complete
[2014-04-25T18:13:08-04:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
Chef Client failed. 83 resources updated in 1839.536577066 seconds
[2014-04-25T18:13:09-04:00] ERROR: service[tomcat] (tomcat::default line 178) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '4'
---- Begin output of /sbin/service tomcat6 restart ----
STDOUT: Stopping tomcat6: [FAILED]
Starting tomcat6: [FAILED]
STDERR:
---- End output of /sbin/service tomcat6 restart ----
Ran /sbin/service tomcat6 restart returned 4
[2014-04-25T18:13:09-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessful
ly (exit code 1)
?[31m>>>>>> Converge failed on instance <my-developer-centos-64>.
?[31m>>>>>> Please see .kitchen/logs/my-developer-centos-64.log for more details
?[31m>>>>>> ------Exception-------
?[31m>>>>>> Class: Kitchen::ActionFailed

1 个答案:

答案 0 :(得分:1)

首先,也许你应该扩展你的问题(实际上,你的帖子中甚至没有问题?),你自己添加一些结论,你已经完成调试的结果。

假设您想知道导致这种情况的原因,我建议将Chef从等式中删除,并直接调查Tomcat为何无法正常工作。

我会执行以下任何操作:

  • kitchen login my-developer-centos-64
  • / sbin / service tomcat6 restart
  • / sbin / service tomcat6 stop
  • / sbin / service tomcat6 start
  • cat / var / log / tomcat6 / *

看看你能找到什么。这可能与Chef无关(应用程序,它可能与您使用Chef 配置的内容有关)。

修改

更多问题:

  • 看起来你正在使用其中的一个&#39;,&#39; redhat&#39;,&#39; fedora&#39;,&#39; amazon&#39;哪一个?
  • 您的日志(在主厨JIRA中)显示错误:/logs/catalina.out: No such file or directory,表示它正在寻找一条不存在的路径/logs。您是否更改了node.tomcat.log_dir值?到底是什么?