0

使用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
4

1 回答 1

1

First, maybe you should expand on your question (actually, there isn't even a question in your post?), add some conclusions you came to on your own, the results of your already done debugging.

Assuming you want to know what is causing this, I would suggest removing Chef from the equation and investigate directly why Tomcat isn't working.

I would perform any of these actions:

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

And see what you can find there. This is probably unrelated to Chef (the application, it might be related to something you configured with Chef).

edit

some more questions:

  • It looks like you are using one of 'centos', 'redhat', 'fedora', 'amazon', which one?
  • Your logs (in Chef JIRA) show the error:/logs/catalina.out: No such file or directory, indicating it is looking for a path /logs, which doesn't exist. Did you change the node.tomcat.log_dir value? To what?
于 2014-04-27T13:07:34.497 回答