安装Tomcat 7 Cookbook期间发生错误。 在Chef-Solo中执行时,出现此错误。 openssl已正确安装。
* execute[Create Tomcat SSL certificate] action run
================================================================================
Error executing action `run` on resource 'execute[Create Tomcat SSL certificate]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '127'
---- Begin output of /usr/lib/jvm/default-java/bin/keytool -genkeypair -keystore "/etc/tomcat7/keystore.jks" -storepass "AWpbettrAMoVK4orJOdi" -keypass "AWpbettrAMoVK4orJOdi" -dname "cn=localhost" ----
STDOUT:
STDERR: sh: 1: /usr/lib/jvm/default-java/bin/keytool: not found
---- End output of /usr/lib/jvm/default-java/bin/keytool -genkeypair -keystore "/etc/tomcat7/keystore.jks" -storepass "AWpbettrAMoVK4orJOdi" -keypass "AWpbettrAMoVK4orJOdi" -dname "cn=localhost" ----
Ran /usr/lib/jvm/default-java/bin/keytool -genkeypair -keystore "/etc/tomcat7/keystore.jks" -storepass "AWpbettrAMoVK4orJOdi" -keypass "AWpbettrAMoVK4orJOdi" -dname "cn=localhost" returned 127
Resource Declaration:
---------------------
# In /root/.chef/chef-repo/cookbooks/tomcat/recipes/default.rb
181: execute "Create Tomcat SSL certificate" do
182: group node['tomcat']['group']
183: command "#{node['tomcat']['keytool']} -genkeypair -keystore \"#{node['tomcat']['config_dir']}/#{node['tomcat']['keystore_file']}\" -storepass \"#{node['tomcat']['keystore_password']}\" -keypass \"#{node['tomcat']['keystore_password']}\" -dname \"#{node['tomcat']['certificate_dn']}\""
184: umask 0007
185: creates "#{node['tomcat']['config_dir']}/#{node['tomcat']['keystore_file']}"
186: action :run
187: notifies :restart, "service[tomcat]"
188: end
189: end
Compiled Resource:
------------------
# Declared in /root/.chef/chef-repo/cookbooks/tomcat/recipes/default.rb:181:in `from_file'
execute("Create Tomcat SSL certificate") do
action [:run]
retries 0
retry_delay 2
command "/usr/lib/jvm/default-java/bin/keytool -genkeypair -keystore \"/etc/tomcat7/keystore.jks\" -storepass \"AWpbettrAMoVK4orJOdi\" -keypass \"AWpbettrAMoVK4orJOdi\" -dname \"cn=localhost\""
backup 5
creates "/etc/tomcat7/keystore.jks"
group "tomcat7"
returns 0
umask 7
cookbook_name :tomcat
recipe_name "default"
end
* service[tomcat] action restart
- restart service service[tomcat]
[2014-02-04T10:42:24-02:00] ERROR: Running exception handlers
[2014-02-04T10:42:24-02:00] ERROR: Exception handlers complete
Chef Client failed. 5 resources updated
[2014-02-04T10:42:24-02:00] FATAL: Stacktrace dumped to /opt/chef-solo/chef-stacktrace.out
[2014-02-04T10:42:24-02:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: execute[Create Tomcat SSL certificate] (tomcat::default line 181) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '127'
---- Begin output of /usr/lib/jvm/default-java/bin/keytool -genkeypair -keystore "/etc/tomcat7/keystore.jks" -storepass "AWpbettrAMoVK4orJOdi" -keypass "AWpbettrAMoVK4orJOdi" -dname "cn=localhost" ----
STDOUT:
STDERR: sh: 1: /usr/lib/jvm/default-java/bin/keytool: not found
---- End output of /usr/lib/jvm/default-java/bin/keytool -genkeypair -keystore "/etc/tomcat7/keystore.jks" -storepass "AWpbettrAMoVK4orJOdi" -keypass "AWpbettrAMoVK4orJOdi" -dname "cn=localhost" ----
Ran /usr/lib/jvm/default-java/bin/keytool -genkeypair -keystore "/etc/tomcat7/keystore.jks" -storepass "AWpbettrAMoVK4orJOdi" -keypass "AWpbettrAMoVK4orJOdi" -dname "cn=localhost" returned 127
如果有人想解决这个问题,请回答:)
答案 0 :(得分:4)
这是一个已知的tomcat食谱问题:COOK-4097
您可以通过为keytool可执行文件指定正确的路径来解决此问题:
override["tomcat"]["keytool"] = "/usr/bin/keytool"
我有working example,请查看食谱的属性部分: