Error running Java Recipe: undefined method `split' for nil:NilClass


#1

Hello all,

I am running a java recipe that is checked out from a Repository that
I do not have write access to, and so I am using my cookbooks attributes
file to change how the software is installed.

We are using Chef 10.14.4 with Vagrant 1.4.3 (versions fixed and out of my control)

I was asked to change the recipe to install Java version 8.

From my cookbooks attributes/default.rb:
#####################################################################

jdk8 attributes

override[‘java’][‘jdk_version’] = '8’
override[“java”][“install_flavor”] = "oracle"
override[“java”][“jdk_version”] = "8"
override[“java”][“jdk”][“8”][“x86_64”][“url”] = "https://nexus.servername.us/repositories/filerepo/com/oracle/jdk/8u40-linux-x64/jdk-8u40-linux-x64-x64.tar.gz"
override[“java”][“jdk”][“8”][“x86_64”][“checksum”] = "da1ad819ce7b7ec528264f831d88afaa5db34b7955e45422a7e380b1ead6b04d"
override[“java”][“osx_dmg”][“app_name”] = "JDK 8 Update 40"
override[“java”][“osx_dmg”][“volumes_dir”] = "JDK 8 Update 40"
override[“java”][“osx_dmg”][“package_id”] = "JDK 8 Update 40.pkg"
override[“java”][“osx_dmg”][“url”] = "https://nexus.servername.us/repositories/filerepo/com/oracle/jdk/8u40-macosx/jdk-8u40-macosx-x64.dmg"
override[“java”][“osx_dmg”][“dmg_name”] = "jdk-8u40-macosx-x64.dmg"
override[“java”][“osx_dmg”][“checksum”] = "1960617eb2fce4b503687d84d791dad72904de680c9bae006172dd9e2b5e0cd0"
override[“java”][“osx_dmg”][“java_home”] = “/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home”

#override[‘java’][‘oracle’][‘accept_oracle_download_terms’] = true

override[‘java’][‘jdk’][‘8’][‘bin_cmds’] = [ ]

x86_64

override[‘java’][‘jdk’][‘8’][‘x86_64’][‘url’] = 'http://download.oracle.com/otn-pub/java/jdk/8u40-b26/jdk-8u40-linux-x64.tar.gz
override[‘java’][‘jdk’][‘8’][‘x86_64’][‘checksum’] = ‘da1ad819ce7b7ec528264f831d88afaa5db34b7955e45422a7e380b1ead6b04d’

i586

override[‘java’][‘jdk’][‘8’][‘i586’][‘url’] = 'http://download.oracle.com/otn-pub/java/jdk/8u40-b26/jdk-8u40-linux-i586.tar.gz
override[‘java’][‘jdk’][‘8’][‘i586’][‘checksum’] = ‘9300846c8ced85d14b9dd8ec5ec379a0af982c589cf6d149ee09d972fe6729b0’
######################END OF ATTRIBUTES SNIPPET###########################

The error:
##################################################################
[2015-04-29T18:32:22-04:00] INFO: Processing java_ark[jdk] action install (java::oracle line 60)

================================================================================
Error executing action install on resource ‘java_ark[jdk]’

NoMethodError

undefined method `split’ for nil:NilClass

Cookbook Trace:

/tmp/vagrant-chef-1/chef-solo-2/cookbooks/java/providers/ark.rb:25:in parse_app_dir_name' /tmp/vagrant-chef-1/chef-solo-2/cookbooks/java/providers/ark.rb:80:inblock in class_from_file’

Resource Declaration:

In /tmp/vagrant-chef-1/chef-solo-2/cookbooks/java/recipes/oracle.rb

60: java_ark “jdk” do
61: url tarball_url
62: checksum tarball_checksum
63: app_home java_home
64: bin_cmds bin_cmds
65: alternatives_priority 1062
66: action :install
67: end
68:

Compiled Resource:

Declared in /tmp/vagrant-chef-1/chef-solo-2/cookbooks/java/recipes/oracle.rb:60:in `from_file’

java_ark(“jdk”) do
action [:install]
supports {:report=>true, :exception=>true}
retries 0
retry_delay 2
cookbook_name :java
recipe_name "oracle"
app_home "/usr/lib/jvm/java"
alternatives_priority 1062
end

[2015-04-29T18:32:22-04:00] DEBUG: Re-raising exception: NoMethodError - java_ark[jdk] (java::oracle line 60) had an error: NoMethodError: undefined method `split’ for nil:NilClass
###############################END ERROR SNIPPET######################

I would be arguing that we need to try upgrading, but this deployment works on some system
but not on others…I am thinking that I have some gem version mismatch but am not clear on
how I might determine this…

All apologies if this is documented…I looked.

Thank you,

Christopher


#2

On Wednesday, April 29, 2015 at 3:54 PM, Christopher Hahn wrote:

Hello all,

I am running a java recipe that is checked out from a Repository that
I do not have write access to, and so I am using my cookbooks attributes
file to change how the software is installed.

We are using Chef 10.14.4 with Vagrant 1.4.3 (versions fixed and out of my control)

I was asked to change the recipe to install Java version 8.
snip…

NoMethodError

undefined method `split’ for nil:NilClass

Cookbook Trace:

/tmp/vagrant-chef-1/chef-solo-2/cookbooks/java/providers/ark.rb:25:in `parse_app_dir_name’

You’ll want to see what this code is doing to help figure out what’s going on.

I would be arguing that we need to try upgrading, but this deployment works on some system
but not on others…I am thinking that I have some gem version mismatch but am not clear on
how I might determine this…

All apologies if this is documented…I looked.

Thank you,

Christopher

Daniel DeLeo


#3

Thank you very much for taking the time…

Yeah…I resisted adding to my post that I am restricted in what I can edit…my berkshelf is
loaded very run and my edits are over-written when I run again.

The line that is crashing is here:

def parse_app_dir_name url
file_name = url.split(’/’)[-1] <-----

I am going to get access to the repo in which we are storing this provider code
so that I can add some prints to the failing call.

I was just hoping that someone might have recognized the situation….I expect that it might stem from
a version mismatch.

I will post more info as I get at it.

Christopher

On Apr 30, 2015, at 7:32 AM, Daniel DeLeo dan@kallistec.com wrote:

On Wednesday, April 29, 2015 at 3:54 PM, Christopher Hahn wrote:

Hello all,

I am running a java recipe that is checked out from a Repository that
I do not have write access to, and so I am using my cookbooks attributes
file to change how the software is installed.

We are using Chef 10.14.4 with Vagrant 1.4.3 (versions fixed and out of my control)

I was asked to change the recipe to install Java version 8.
snip…

NoMethodError

undefined method `split’ for nil:NilClass

Cookbook Trace:

/tmp/vagrant-chef-1/chef-solo-2/cookbooks/java/providers/ark.rb:25:in `parse_app_dir_name’

You’ll want to see what this code is doing to help figure out what’s going on.

I would be arguing that we need to try upgrading, but this deployment works on some system
but not on others…I am thinking that I have some gem version mismatch but am not clear on
how I might determine this…

All apologies if this is documented…I looked.

Thank you,

Christopher

Daniel DeLeo


#4

On Thursday, April 30, 2015 at 10:53 AM, Christopher Hahn wrote:

Thank you very much for taking the time…

Yeah…I resisted adding to my post that I am restricted in what I can edit…my berkshelf is
loaded very run and my edits are over-written when I run again.

The line that is crashing is here:

def parse_app_dir_name url
file_name = url.split(’/’)[-1] <-----

I am going to get access to the repo in which we are storing this provider code
so that I can add some prints to the failing call.

If you run chef-client with -l debug or look at the stacktrace.out file, you’ll get the non-filtered stack trace, which you can use to follow the method calls back, which hopefully will help you track down where the bogus value comes from, even if you can’t add debug statements.


Daniel DeLeo