【问题标题】:Error Provisioning Tomcat Cookbook on `restart`在“重新启动”时配置 Tomcat Cookbook 时出错
【发布时间】:2014-05-01 12:04:14
【问题描述】:

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

【问题讨论】:

    标签: tomcat chef-infra cookbook


    【解决方案1】:

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

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

    我会执行以下任何操作:

    • 厨房登录 my-developer-centos-64
    • /sbin/service tomcat6 重启
    • /sbin/service tomcat6 停止
    • /sbin/service tomcat6 start
    • cat /var/log/tomcat6/*

    看看你能在那里找到什么。这可能与 Chef 无关(应用程序,它可能与您用 Chef 配置的东西有关)。

    编辑

    还有一些问题:

    • 您使用的似乎是“centos”、“redhat”、“fedora”、“amazon”中的一种,是哪一种?
    • 您的日志(在 Chef JIRA 中)显示错误:/logs/catalina.out: No such file or directory,表明它正在寻找不存在的路径 /logs。您是否更改了 node.tomcat.log_dir 值?去什么?

    【讨论】:

    • 谢谢,JeanMartz。重新运行命令的好建议,以及鼓励我正确列出我解决问题的尝试。运行 /sbin/service tomcat6 restart,在类路径 (Error: Could not find or load main class org.apache.catalina.startup.Bootstrap) 上找不到 JAR。当我更改 tomcat.home 食谱属性时发生此错误。
    • @KevinMeredith 我根据你的 JIRA 票更新了我的答案。
    猜你喜欢
    • 2012-06-07
    • 1970-01-01
    • 1970-01-01
    • 2017-05-21
    • 2013-12-07
    • 2016-12-06
    • 2014-05-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多