【发布时间】:2014-05-07 14:28:56
【问题描述】:
我尝试使用 Chef Solo 和 Berkshelf 设置一个 vagrant vm。我想使用maven 食谱。 “maven”依赖于“java”和“java_ark”(包含在“java”食谱中)。它们都是由 Opscode 创建的。
但是每次我得到这个错误:
NoMethodError
-------------
undefined method `[]' for nil:NilClass
Cookbook Trace:
---------------
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/recipes/default.rb:21:in `from_file'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/platform-slayer/recipes/slayer_worker.rb:2:in `from_file'
Relevant File Content:
----------------------
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/recipes/default.rb:
14: # Unless required by applicable law or agreed to in writing, software
15: # distributed under the License is distributed on an "AS IS" BASIS,
16: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: # See the License for the specific language governing permissions and
18: # limitations under the License.
19: #
20:
21>> include_recipe "java::#{node['java']['install_flavor']}"
22:
23: # Purge the deprecated Sun Java packages if remove_deprecated_packages is true
24: %w[sun-java6-jdk sun-java6-bin sun-java6-jre].each do |pkg|
25: package pkg do
26: action :purge
27: only_if { node['java']['remove_deprecated_packages'] }
28: end
29: end
30:
有人知道这个问题吗? 如果您需要更多信息,请告诉我。
【问题讨论】:
-
好像没有安装java。你能确认是否安装了java吗?你能打印
java -version -
感谢您的回复!不,Java 安装因我发布的错误而中止。
-
哪个操作系统?您可以使用其他包管理工具吗?你能打印
roles/base.rb吗?您可能必须覆盖 oracle 下载条款。 -
没有角色/base.rb 覆盖已经完成,但没有效果。我使用 Xubuntu 作为主机操作系统,使用 Debian Wheezy 作为客户操作系统
-
如果你的open-jdk没问题,我相信
sudo apt-get install openjdk-7-jre会安装java。能不能在外部安装java后再试一下。
标签: java ruby maven chef-infra vagrant