Git Product home page Git Product logo

java's Introduction

java cookbook

Cookbook Version Build Status OpenCollective OpenCollective License

This cookbook installs a Java JDK/JRE. It defaults to installing OpenJDK, but it can also install AdoptOpenJDK and Amazon Corretto.

Maintainers

This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.

Usage

Requirements

Chef 15.3+

Platforms

  • Debian, Ubuntu
  • CentOS, RedHat, Fedora, Scientific, Amazon

Resources

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

https://opencollective.com/sous-chefs#backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

https://opencollective.com/sous-chefs/sponsor/0/website https://opencollective.com/sous-chefs/sponsor/1/website https://opencollective.com/sous-chefs/sponsor/2/website https://opencollective.com/sous-chefs/sponsor/3/website https://opencollective.com/sous-chefs/sponsor/4/website https://opencollective.com/sous-chefs/sponsor/5/website https://opencollective.com/sous-chefs/sponsor/6/website https://opencollective.com/sous-chefs/sponsor/7/website https://opencollective.com/sous-chefs/sponsor/8/website https://opencollective.com/sous-chefs/sponsor/9/website

java's People

Contributors

bobbywarner avatar bryanwb avatar cap10morgan avatar carmstrong avatar cbarraford avatar damacus avatar danielsdeleo avatar dezka avatar erichelgeson avatar freakinhippie avatar frezbo avatar gzurowski avatar ifel avatar jakauppila avatar jgawor avatar johnroesler avatar juliandunn avatar kitchen-porter avatar majormoses avatar powerschill avatar ramereth avatar rcjim avatar renovate[bot] avatar schisamo avatar sethvargo avatar spion06 avatar tas50 avatar taylor-benson avatar xorima avatar xorimabot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java's Issues

checksum comparison is not working, forcing re-download of existing java archive

I'm running chef-solo with vagrant along with vagrant-cachier plugin. My project is using the java cookbook. The problem I'm running into is that each time I 'vagrant up' a fresh vm, even though I have the specified java archive downloaded into my cache directory, the checksum comparison is not working and I'm forced to download java each time which slows provisioning down considerably.

After troubleshooting, I fixed the problem in my local copy of the cookbook. Line 57 in providers/ark.rb should be:

  downloaded_sha == new_resource.checksum

instead of:

  downloaded_sha == new_resource.md5 

When I made this change locally, the recipe would successfully detect that I had already downloaded the archive and skip it.

I tried to be a good open source citizen and follow the instructions for contributing a pull request ( this would have been my first on github ) but I ran into problems trying to follow the instructions to setup my machine in order to run the chefspec tests. Unfortunately, I've got a conflict when running "vagrant plugin install vagrant-berkshelf":


The plugin(s) can't be installed due to the version conflicts below.
This means that the plugins depend on a library version that conflicts
with other plugins or Vagrant itself, creating an impossible situation
where Vagrant wouldn't be able to load the plugins.

You can fix the issue by either removing a conflicting plugin or
by contacting a plugin author to see if they can address the conflict.

Vagrant could not find compatible versions for gem "celluloid":
In Gemfile:
vagrant-berkshelf (>= 0) ruby depends on
celluloid (~> 0.13.0) ruby

vagrant (= 1.5.1) ruby depends on
  celluloid (0.15.2)

I'm a chef/ruby/vagrant newbie. I had stumbled on this issue with the java cookbook on my first attempt at teaching myself. I consider it success enough at this point in my knowledge to have successfully trouble-shot the issue, but unfortunately given where I am now in my learning its a bit ambitious for me to try to figure out how to resolve this dependency issue and learn the tools for writing chef unit and integration tests.

So in the meantime, the best thing I can do is submit this issue. In the future if this issue still exists and I'm a bit more seasoned, I'll take a crack at trying to create a pull request.

In the meantime, thanks for sharing the plugin in the first place.

Oracle Java 8 Install, Stalls then Fails...

I'm having difficulty getting this cookbook to install Java 8 from Oracle. It just stalls on this line:

==> default: [2014-09-16T20:51:50+00:00] INFO: Adding jdk to /usr/lib/jvm/jdk1.8.0_20

and then after many minutes fully fails with this:

==> default: ================================================================================
==> default: Error executing action `install` on resource 'java_ark[jdk]'
==> default: ================================================================================
==> default: 
==> default: 
==> default: Mixlib::ShellOut::CommandTimeout
==> default: --------------------------------
==> default: Command timed out after 600s:
==> default: 
==> default: Command execeded allowed execution time, process terminated
==> default: 
==> default: ---- Begin output of  curl --create-dirs -L --retry 0 --retry-delay 2 --cookie "oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u20-b26/jdk-8u20-linux-x64.tar.gz -o /var/chef/cache/jdk-8u20-linux-x64.tar.gz  ----
==> default: 
==> default: STDOUT: 
==> default: 
==> default: STDERR: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
==> default: 
==> default:                                  Dload  Upload   Total   Spent    Left  Speed
==> default: 
  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0
==> default: 
  0     0    0     0    0     0      0      0 --:--:--  0:00:11 --:--:--     0
==> default: 
  3  153M    3 5169k    0     0  24063      0  1:51:25  0:03:39  1:47:46 17572
  7  153M    7 10.8M    0     0  26621      0  1:40:43  0:07:05  1:33:37 33174
 10  153M   10 16.4M    0     0  27238      0  1:38:26  0:10:33  1:27:53 15027
 10  153M   10 16.8M    0     0  27222      0  1:38:29  0:10:49  1:27:40 28960
==> default: 
==> default: ---- End output of  curl --create-dirs -L --retry 0 --retry-delay 2 --cookie "oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u20-b26/jdk-8u20-linux-x64.tar.gz -o /var/chef/cache/jdk-8u20-linux-x64.tar.gz  ----
==> default: Ran  curl --create-dirs -L --retry 0 --retry-delay 2 --cookie "oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u20-b26/jdk-8u20-linux-x64.tar.gz -o /var/chef/cache/jdk-8u20-linux-x64.tar.gz  returned 
==> default: 
==> default: Cookbook Trace:
==> default: ---------------
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/java/providers/ark.rb:81:in `block in download_direct_from_oracle'
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/java/providers/ark.rb:78:in `download_direct_from_oracle'
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/java/providers/ark.rb:124:in `block in class_from_file'
==> default: 
==> default: Resource Declaration:
==> default: ---------------------
==> default: # In /tmp/vagrant-chef-3/chef-solo-1/cookbooks/java/recipes/oracle.rb
==> default: 
==> default:  53: java_ark "jdk" do
==> default:  54:   url tarball_url
==> default:  55:   default node['java']['set_default']
==> default:  56:   checksum tarball_checksum
==> default:  57:   app_home java_home
==> default:  58:   bin_cmds bin_cmds
==> default:  59:   alternatives_priority node['java']['alternatives_priority']
==> default:  60:   retries node['java']['ark_retries']
==> default:  61:   retry_delay node['java']['ark_retry_delay']
==> default:  62:   action :install
==> default:  63: end
==> default:  64: 
==> default: 
==> default: Compiled Resource:
==> default: ------------------
==> default: # Declared in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/java/recipes/oracle.rb:53:in `from_file'
==> default: 
==> default: java_ark("jdk") do
==> default:   action [:install]
==> default:   supports {:report=>true, :exception=>true}
==> default:   retries 0
==> default:   retry_delay 2
==> default:   guard_interpreter :default
==> default:   cookbook_name :java
==> default:   recipe_name "oracle"
==> default:   url "http://download.oracle.com/otn-pub/java/jdk/8u20-b26/jdk-8u20-linux-x64.tar.gz"
==> default:   default true
==> default:   checksum "ec7f89dc3697b402e2c851d0488f6299"
==> default:   app_home "/usr/lib/jvm/java-8-oracle-amd64"
==> default:   bin_cmds ["appletviewer", "apt", "ControlPanel", "extcheck", "idlj", "jar", "jarsigner", "java", "javac", "javadoc", "javafxpackager", "javah", "javap", "javaws", "jcmd", "jconsole", "jcontrol", "jdb", "jdeps", "jhat", "jinfo", "jjs", "jmap", "jmc", "jps", "jrunscript", "jsadebugd", "jstack", "jstat", "jstatd", "jvisualvm", "keytool", "native2ascii", "orbd", "pack200", "policytool", "rmic", "rmid", "rmiregistry", "schemagen", "serialver", "servertool", "tnameserv", "unpack200", "wsgen", "wsimport", "xjc"]
==> default:   alternatives_priority 1062
==> default:   owner "root"
==> default: end
==> default: 
==> default: [2014-09-16T21:02:44+00:00] INFO: Running queued delayed notifications before re-raising exception
==> default: [2014-09-16T21:02:44+00:00] ERROR: Running exception handlers
==> default: [2014-09-16T21:02:44+00:00] ERROR: Exception handlers complete
==> default: [2014-09-16T21:02:44+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2014-09-16T21:02:44+00:00] ERROR: java_ark[jdk] (java::oracle line 53) had an error: Mixlib::ShellOut::CommandTimeout: Command timed out after 600s:
==> default: Command execeded allowed execution time, process terminated
==> default: ---- Begin output of  curl --create-dirs -L --retry 0 --retry-delay 2 --cookie "oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u20-b26/jdk-8u20-linux-x64.tar.gz -o /var/chef/cache/jdk-8u20-linux-x64.tar.gz  ----
==> default: STDOUT: 
==> default: STDERR: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
==> default:                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:11 --:--:--     0
  2  153M    2 4668k    0     0  24041      0  1:51:31  0:03:16  1:48:15 27688
  6  153M    6 10.1M    0     0  26386      0  1:41:36  0:06:43  1:34:53 18702
 10  153M   10 15.9M    0     0  27283      0  1:38:16  0:10:11  1:28:05 26133
 10  153M   10 16.8M    0     0  27222      0  1:38:29  0:10:49  1:27:40 2896036330
==> default: ---- End output of  curl --create-dirs -L --retry 0 --retry-delay 2 --cookie "oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u20-b26/jdk-8u20-linux-x64.tar.gz -o /var/chef/cache/jdk-8u20-linux-x64.tar.gz  ----
==> default: Ran  curl --create-dirs -L --retry 0 --retry-delay 2 --cookie "oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u20-b26/jdk-8u20-linux-x64.tar.gz -o /var/chef/cache/jdk-8u20-linux-x64.tar.gz  returned 
==> default: [2014-09-16T21:02:44+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

I'm guessing that this means that chef couldn't download java8 from Oracle...perhaps related to the process?

For reference, I'm using the latest versions of: Mac OS X (host), Vagrant, VirtualBox and Ubuntu (in VM).

For reference, I have a very simple cookbook that I'm building up. Here's the full cookbook:

~/Vagrantfile:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "ubuntu/trusty64"

  config.berkshelf.enabled = true
  config.berkshelf.berksfile_path = "cookbooks/foobar-appserver/Berksfile"

  config.omnibus.chef_version = :latest

  config.vm.provision "chef_solo" do |chef|
    chef.add_recipe "foobar-appserver"
  end

end

~/cookbooks/foobar-appserver/attributes/java.rb:

default["java"]["install_flavor"] = "oracle"
default["java"]["jdk_version"] = "8"
default["java"]["oracle"]["accept_oracle_download_terms"] = true

~/cookbooks/foobar-appserver/Berksfile:

source "https://supermarket.getchef.com"
metadata

~/cookbooks/foobar-appserver/chefignore:

[Default generated by 'chef generate...']

~/cookbooks/foobar-appserver/metadata.rb:

name             'foobar-appserver'
maintainer       'The Authors'
maintainer_email '[email protected]'
license          'all_rights'
description      'Installs/Configures foobar-appserver'
long_description 'Installs/Configures foobar-appserver'
version          '0.1.0'

depends "apt"
depends "java"

~/cookbooks/foobar-appserver/recipes/default.rb:

include_recipe 'apt'
include_recipe 'java'

update-alternatives doesn't work on CentOS.

on Centos "update-alternavites" and "alternatives" do not behave the same way. currently (1.7.2) the alternatives.rb file uses "update-alternatives --display ......" which does not work on CentOS. It needs to be "alternatives --display ....."

That change will make the cookbook be re-runnable on a convergence node.

Add Webupd8 Java repo support for Ubuntu

The Webupd8 team provides a great support for Oracle Java packages on Ubuntu platform. Their PPA is always up-to-date and also integrates Oracle Java packages into Ubuntu's alternative system correctly, and handles updates too. The only one thing is we have to automatically accept license term.

I tried to create a recipe for it, but I do not know how can I auto-accept license terms to allow package's postinstall script to download and install the package from oracle.

Repo: https://launchpad.net/~webupd8team/+archive/java

Should "oracle" be installed via rpm on RHEL?

This is more of a question than an issue.

I'm just wondering whether the oracle recipe should check for the existence of the java-1.7.0-oracle (available on RHEL from the rhel-extras repository) instead of downloading the binary and performing a "manual" install.

Fail to fetch and 404 Not Found

When I run this cookbook for installation on an ubuntu virtual machine, it pop ups the stack trace with continous 404 Not Found errors and then Failed to fetch errors. Can anyone help me with this? Thanks

Cut a new release

Is there a schedule or intended time for cutting a new release of this cookbook? I have some commits recently merged here that I would like to see available in a release.

Thanks!

Looks like Oracle are now enforcing mandatory registration before download

The java::oracle recipe was failing for me even after setting node['java']['oracle']['accept_oracle_download_terms'] = true the remote file that's downloaded into /var/chef/cache as jdk-6u45-linux-x64.bin (JDK version 6) or jdk-7u51-linux-x64.tar.gz (JDK version 7) is actually a page of html containing an Oracle login box.

I confirmed this by manually going to the Oracle downloads page, clicking the 'agree to terms' button and then clicking the the download link for the relevant JDK file - you're taken to a page asking you to login, rather than downloading the file.

Problem with failed alternatives

I ran into the issue of "failed" Java alternatives preventing a successful Chef run (failed on line 41 of providers/alternatives.rb) and resolved it per this StackOverflow comment. I wound up adding the following on line 35 of providers/alternatives.rb, but this only pertains to RHEL due to the path. I know the path for Ubuntu is /var/lib/dpkg/alternatives, but not sure for any other platforms. I have my monkeypatch in place, but thought I'd alert you to the issue in case you'd like to solve it properly going forward. I'd submit a pull request, but without knowing the path for any platforms beyond RHEL and Ubuntu leaves a lot to be desired.

      # delete failed alternative if needed
      if !::File.exist?(bin_path) && ::File.exist?("/var/lib/alternatives/#{cmd}")
        Chef::Log.debug "Failed alternative for #{cmd} exists - deleting"
        ::File.unlink("/var/lib/alternatives/#{cmd}")
      end

java 1.17.4 incompatible with chef 10.24.0

I'm getting the following when using 1.17.4 on chef 10.24.0. It would appear to be due to this change.

FATAL: NoMethodError: java_ark[jdk] (java::oracle line 47) had an error: NoMethodError: undefined method `headers' for Chef::Resource::RemoteFile

java_home attribute not set for ubuntu

looks like java_home attribute is not being set anymore for anything other than 'ibm', 'ibm_tar', 'oracle_rpm'

going to try to find the commit that broke it.

Understanding node['java']['tarball']

Reading the docs:

* `node['java']['tarball']` - Name of the tarball to retrieve from your 
internal repository, default `jdk1.6.0_29_i386.tar.gz

I'm confused as to the "internal repository" part. How would I set this attribute if I wanted to use:

* c:\users\Kevin\Downloads\jdk-7u55-linux-x64.gz?

Add alternative for appletviewer[2014-02-12T04:51:58+00:00] FATAL: set alternative failed

I ran into an issue while setting up for java 7.

  • java_alternatives[set-java-alternatives] action set
    • Add alternative for appletviewer[2014-02-12T04:51:58+00:00] FATAL: set alternative failed

Error executing action set on resource 'java_alternatives[set-java-alternatives]'

SystemExit

exit

Cookbook Trace:

/var/chef/cache/cookbooks/java/providers/alternatives.rb:58:in block (3 levels) in class_from_file' /var/chef/cache/cookbooks/java/providers/alternatives.rb:54:inblock (2 levels) in class_from_file'
/var/chef/cache/cookbooks/java/providers/alternatives.rb:24:in each' /var/chef/cache/cookbooks/java/providers/alternatives.rb:24:inblock in class_from_file'

Resource Declaration:

In /var/chef/cache/cookbooks/java/providers/ark.rb

206: java_alternatives 'set-java-alternatives' do
207: java_location app_home
208: bin_cmds new_resource.bin_cmds
209: priority new_resource.alternatives_priority
210: default new_resource.default
211: action :set
212: end
213: end

Compiled Resource:

Declared in /var/chef/cache/cookbooks/java/providers/ark.rb:206:in `block in class_from_file'

java_alternatives("set-java-alternatives") do
action [:set]
updated true
updated_by_last_action true
retries 0
retry_delay 2
cookbook_name "java"
java_location "/usr/lib/jvm/java"
bin_cmds ["appletviewer", "apt", "ControlPanel", "extcheck", "idlj", "jar", "jarsigner", "java", "javac", "javadoc", "javafxpackager", "javah", "javap", "javaws", "jcmd", "jconsole", "jcontrol", "jdb", "jhat", "jinfo", "jmap", "jps", "jrunscript", "jsadebugd", "jstack", "jstat", "jstatd", "jvisualvm", "keytool", "native2ascii", "orbd", "pack200", "policytool", "rmic", "rmid", "rmiregistry", "schemagen", "serialver", "servertool", "tnameserv", "unpack200", "wsgen", "wsimport", "xjc"]
priority 1062
default true
end

[2014-02-12T04:51:58+00:00] ERROR: Running exception handlers
[2014-02-12T04:51:58+00:00] ERROR: Exception handlers complete
[2014-02-12T04:51:58+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 21 resources updated
[2014-02-12T04:51:58+00:00] ERROR: java_alternatives[set-java-alternatives](/var/chef/cache/cookbooks/java/providers/ark.rb line 206) had an error: SystemExit: exit

[2014-02-12T04:51:58+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Please suggest

java_home doesn't honor role attributes

I've created a role that sets the jdk_version and install_flavor. It results int he correct version of java being installed, but the JAVA_HOME results in some strange directory names.

The role looks like this:

{
  "name": "javatest",
  "description": "Test starting java",
  "json_class": "Chef::Role",
  "chef_type": "role",
  "override_attributes": {
    "java": {
      "jdk_version": 7,
      "install_flavor": "oracle",
      "oracle": {
        "accept_oracle_download_terms": true
      }
    }
  },
  "run_list": [
    "recipe[apt::default]",
    "recipe[java]"
  ]
}

Here is an ssh session that shows that JAVA_HOME points to a very confusingly named directory.

vagrant@ubuntu-vagrant:~$ echo $JAVA_HOME
/usr/lib/jvm/java-6-openjdk-amd64
vagrant@ubuntu-vagrant:~$ ll /usr/lib/jvm/
total 16
drwxr-xr-x  3 root root 4096 Dec 15 21:54 ./
drwxr-xr-x 51 root root 4096 Dec 15 21:53 ../
lrwxrwxrwx  1 root root   24 Dec 15 21:54 java-6-openjdk-amd64 -> /usr/lib/jvm/jdk1.7.0_25/
-rw-------  1 root root 2594 Dec 15 21:54 .java-6-openjdk-amd64.jinfo
drwxr-xr-x  8  500  143 4096 Jun  6  2013 jdk1.7.0_25/
vagrant@ubuntu-vagrant:~$ cat /etc/profile.d/jdk.sh
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64vagrant@ubuntu-vagrant:~$
vagrant@ubuntu-vagrant:~$ java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

Am I setting the attributes incorrectly?

"Alternatives" not being set on Amazon AMI

I'm trying to launch an Amazon Linux instance in OpsWorks and have it get upgraded to Java 7. It appears that it's getting installed fine, but the call to set it as the default version using alternatives isn't taking. When I log into the instance and run "java -version" I still get:

java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.14) (amazon-65.1.11.14.57.amzn1-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

If I run sudo alternatives --config java I see

*+ 1           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
   2           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java

Selecting 2 makes the change as expected.

I believe I've included the relevant bits of the log below, and there are no obvious errors. If I switch the instance type in OpsWorks to be Ubuntu, everything works fine (but then some other recipes that are more finicky break).

The only custom json I'm passing in is to specify java 7:

{
    "java": {
        "jdk_version":7
    }
}

Sorry if I've missed something obvious; I'm pretty new to all of this, but as far as I can tell, this should just work?

[2014-01-16T02:11:49+00:00] INFO: Processing package[java-1.7.0-openjdk] action install (java::openjdk line 35)
[2014-01-16T02:11:49+00:00] DEBUG: package[java-1.7.0-openjdk] checking yum info for java-1.7.0-openjdk
[2014-01-16T02:11:49+00:00] DEBUG: package[java-1.7.0-openjdk] installed version: (none) candidate version: 1.7.0.45-2.4.3.2.32.amzn1
[2014-01-16T02:11:49+00:00] INFO: package[java-1.7.0-openjdk] installing java-1.7.0-openjdk-1.7.0.45-2.4.3.2.32.amzn1 from amzn-updates repository
[2014-01-16T02:11:49+00:00] DEBUG: Executing yum -d0 -e0 -y install java-1.7.0-openjdk-1.7.0.45-2.4.3.2.32.amzn1
[2014-01-16T02:11:58+00:00] DEBUG: ---- Begin output of yum -d0 -e0 -y install java-1.7.0-openjdk-1.7.0.45-2.4.3.2.32.amzn1 ----
[2014-01-16T02:11:58+00:00] DEBUG: STDOUT: 
[2014-01-16T02:11:58+00:00] DEBUG: STDERR: 
[2014-01-16T02:11:58+00:00] DEBUG: ---- End output of yum -d0 -e0 -y install java-1.7.0-openjdk-1.7.0.45-2.4.3.2.32.amzn1 ----
[2014-01-16T02:11:58+00:00] DEBUG: Ran yum -d0 -e0 -y install java-1.7.0-openjdk-1.7.0.45-2.4.3.2.32.amzn1 returned 0
[2014-01-16T02:11:58+00:00] INFO: Processing package[java-1.7.0-openjdk-devel] action install (java::openjdk line 35)
[2014-01-16T02:12:00+00:00] DEBUG: package[java-1.7.0-openjdk-devel] checking yum info for java-1.7.0-openjdk-devel
[2014-01-16T02:12:00+00:00] DEBUG: package[java-1.7.0-openjdk-devel] installed version: (none) candidate version: 1.7.0.45-2.4.3.2.32.amzn1
[2014-01-16T02:12:00+00:00] INFO: package[java-1.7.0-openjdk-devel] installing java-1.7.0-openjdk-devel-1.7.0.45-2.4.3.2.32.amzn1 from amzn-updates repository
[2014-01-16T02:12:00+00:00] DEBUG: Executing yum -d0 -e0 -y install java-1.7.0-openjdk-devel-1.7.0.45-2.4.3.2.32.amzn1
[2014-01-16T02:12:04+00:00] DEBUG: ---- Begin output of yum -d0 -e0 -y install java-1.7.0-openjdk-devel-1.7.0.45-2.4.3.2.32.amzn1 ----
[2014-01-16T02:12:04+00:00] DEBUG: STDOUT: 
[2014-01-16T02:12:04+00:00] DEBUG: STDERR: 
[2014-01-16T02:12:04+00:00] DEBUG: ---- End output of yum -d0 -e0 -y install java-1.7.0-openjdk-devel-1.7.0.45-2.4.3.2.32.amzn1 ----
[2014-01-16T02:12:04+00:00] DEBUG: Ran yum -d0 -e0 -y install java-1.7.0-openjdk-devel-1.7.0.45-2.4.3.2.32.amzn1 returned 0
[2014-01-16T02:12:04+00:00] INFO: Processing java_alternatives[set-java-alternatives] action set (java::openjdk line 39)
[2014-01-16T02:12:04+00:00] INFO: Processing ruby_block[set-env-java-home] action run (java::set_java_home line 19)
[2014-01-16T02:12:04+00:00] INFO: ruby_block[set-env-java-home] called
[2014-01-16T02:12:04+00:00] INFO: Processing directory[/etc/profile.d] action create (java::set_java_home line 26)
[2014-01-16T02:12:04+00:00] INFO: Processing file[/etc/profile.d/jdk.sh] action create (java::set_java_home line 30)
[2014-01-16T02:12:05+00:00] INFO: entered create
[2014-01-16T02:12:05+00:00] INFO: file[/etc/profile.d/jdk.sh] mode changed to 755
[2014-01-16T02:12:05+00:00] INFO: file[/etc/profile.d/jdk.sh] created file /etc/profile.d/jdk.sh
[2014-01-16T02:12:05+00:00] INFO: Processing package[sun-java6-jdk] action purge (java::default line 56)
[2014-01-16T02:12:05+00:00] DEBUG: Skipping package[sun-java6-jdk] due to only_if ruby block
[2014-01-16T02:12:05+00:00] INFO: Processing package[sun-java6-bin] action purge (java::default line 56)
[2014-01-16T02:12:05+00:00] DEBUG: Skipping package[sun-java6-bin] due to only_if ruby block
[2014-01-16T02:12:05+00:00] INFO: Processing package[sun-java6-jre] action purge (java::default line 56)
[2014-01-16T02:12:05+00:00] DEBUG: Skipping package[sun-java6-jre] due to only_if ruby block

Consolidate java::oracle_i386 and java::oracle (was COOK-2938)

Transferring over from COOK-2938

% diff recipes/oracle.rb recipes/oracle_i386.rb
4c4
< # Recipe:: oracle

---
> # Recipe:: oracle_i386
6c6
< # Copyright 2011, Bryan w. Berry

---
> # Copyright 2010-2011, Opscode, Inc.
20d19
<
22,28d20
< arch = node['java']['arch']
< jdk_version = node['java']['jdk_version']
<
< #convert version number to a string if it isn't already
< if jdk_version.instance_of? Fixnum
<   jdk_version = jdk_version.to_s
< end
30c22
< case jdk_version

---
> case node['java']['jdk_version']
32,33c24,25
<   tarball_url = node['java']['jdk']['6'][arch]['url']
<   tarball_checksum = node['java']['jdk']['6'][arch]['checksum']

---
>   tarball_url = node['java']['jdk']['6']['i586']['url']
>   tarball_checksum = node['java']['jdk']['6']['i586']['checksum']
36,37c28,29
<   tarball_url = node['java']['jdk']['7'][arch]['url']
<   tarball_checksum = node['java']['jdk']['7'][arch]['checksum']

---
>   tarball_url = node['java']['jdk']['7']['i586']['url']
>   tarball_checksum = node['java']['jdk']['7']['i586']['checksum']
41,44d32
< if tarball_url =~ /example.com/
<   Chef::Application.fatal!("You must change the download link to your private repository. You can no longer download java directly from http://download.oracle.com without a web broswer")
< end
<
47c35,40
< java_ark "jdk" do

---
> yum_package "glibc" do
>   arch "i686"
>   only_if { platform_family?( "rhel", "fedora" ) }
> end
>
> java_ark "jdk-alt" do
52d44
<   alternatives_priority 1062
53a46
>   default false
55d47
<

As I mentioned on the other ticket, I don't have cycles right now to implement and test this adequately, but am opening it up here for tracking purposes.

java_home is required to run oracle jdk 7

Environment: Ubuntu 13 / 14.

Setting the jdk_version => "7" alone is not sufficient when using install_flavor => "oracle" - in order to get the cookbook to install oracle 7, I had to manually set "java_home" => "/usr/java/latest".

creating a NOOP install-method

I'm installing oracle-java via an own custom deb-package. This is nearly impossible with the current state of this cookbook. I could create a sophisticated new install-method however it might be more practical also for other usecases to create a no-operation install_method which simply would does nothing and deal with the installation method in some other way.

Would you accept such a pull-request? Anything you want me to consider for something like this?

JDK 7, with default['java']['jdk']['7']['x86_64']['url'] fails

I added a URL to download the JDK 7 from a s3 storage, rather than oracle site, but I get the following error :

here is the full log in Vagrant:

==> default: Recipe: apt::default
==> default:   * execute[apt-get-update] action nothing (skipped due to action :nothing)
==> default:   * execute[apt-get-update] action run (skipped due to only_if)
==> default:   * execute[apt-get update] action nothing (skipped due to action :nothing)
==> default:   * execute[apt-get autoremove] action nothing (skipped due to action :nothing)
==> default:   * execute[apt-get autoclean] action nothing (skipped due to action :nothing)
==> default:   * package[update-notifier-common] action install (skipped due to only_if)
==> default:   * execute[apt-get-update-periodic] action run (skipped due to only_if)
==> default:   * directory[/var/cache/local] action create (skipped due to only_if)
==> default:   * directory[/var/cache/local/preseeding] action create (skipped due to only_if)
==> default: Recipe: cccis-weblogic::create_ccc_directory_structure
==> default:   * user[root] action create (up to date)
==> default:   * group[root] action create (up to date)
==> default:   * directory[/tools/binaries] action create[2014-09-26T15:41:25-04:00] INFO: directory[/tools/binaries] created directory /tools/b                                                     inaries
==> default:
==> default:     - create new directory /tools/binaries[2014-09-26T15:41:25-04:00] INFO: directory[/tools/binaries] owner changed to 0
==> default: [2014-09-26T15:41:25-04:00] INFO: directory[/tools/binaries] group changed to 0
==> default: [2014-09-26T15:41:25-04:00] INFO: directory[/tools/binaries] mode changed to 755
==> default:
==> default:     - change mode from '' to '0755'
==> default:     - change owner from '' to 'root'
==> default:     - change group from '' to 'root'
==> default:     - restore selinux security context
==> default:   * user[orainst] action create[2014-09-26T15:41:26-04:00] INFO: user[orainst] created
==> default:
==> default:     - create user orainst
==> default:   * group[oraapps] action create[2014-09-26T15:41:26-04:00] INFO: group[oraapps] created
==> default:
==> default:     - create group[oraapps]
==> default:   * directory[/tools/appsw] action create[2014-09-26T15:41:26-04:00] INFO: directory[/tools/appsw] created directory /tools/appsw
==> default:
==> default:     - create new directory /tools/appsw[2014-09-26T15:41:26-04:00] INFO: directory[/tools/appsw] owner changed to 54322
==> default: [2014-09-26T15:41:26-04:00] INFO: directory[/tools/appsw] group changed to 54324
==> default: [2014-09-26T15:41:26-04:00] INFO: directory[/tools/appsw] mode changed to 755
==> default:
==> default:     - change mode from '' to '0755'
==> default:     - change owner from '' to 'orainst'
==> default:     - change group from '' to 'oraapps'
==> default:     - restore selinux security context
==> default:   * user[orainst] action create (up to date)
==> default:   * group[oraapps] action create (up to date)
==> default:   * directory[/tools/appsw] action create (up to date)
==> default:   * user[orainst] action create (up to date)
==> default:   * group[oraapps] action create (up to date)
==> default:   * directory[/tools/appsw/oracle] action create[2014-09-26T15:41:26-04:00] INFO: directory[/tools/appsw/oracle] created directory                                                      /tools/appsw/oracle
==> default:
==> default:     - create new directory /tools/appsw/oracle[2014-09-26T15:41:26-04:00] INFO: directory[/tools/appsw/oracle] owner changed to 543                                                     22
==> default: [2014-09-26T15:41:26-04:00] INFO: directory[/tools/appsw/oracle] group changed to 54324
==> default: [2014-09-26T15:41:26-04:00] INFO: directory[/tools/appsw/oracle] mode changed to 755
==> default:
==> default:     - change mode from '' to '0755'
==> default:     - change owner from '' to 'orainst'
==> default:     - change group from '' to 'oraapps'
==> default:     - restore selinux security context
==> default:   * user[orainst] action create (up to date)
==> default:   * group[oraapps] action create (up to date)
==> default:   * directory[/tools/utilsw] action create[2014-09-26T15:41:26-04:00] INFO: directory[/tools/utilsw] created directory /tools/utils                                                     w
==> default:
==> default:     - create new directory /tools/utilsw[2014-09-26T15:41:26-04:00] INFO: directory[/tools/utilsw] owner changed to 54322
==> default: [2014-09-26T15:41:26-04:00] INFO: directory[/tools/utilsw] group changed to 54324
==> default: [2014-09-26T15:41:26-04:00] INFO: directory[/tools/utilsw] mode changed to 755
==> default:
==> default:     - change mode from '' to '0755'
==> default:     - change owner from '' to 'orainst'
==> default:     - change group from '' to 'oraapps'
==> default:     - restore selinux security context
==> default:   * user[orainst] action create (up to date)
==> default:   * group[oraapps] action create (up to date)
==> default:   * directory[/tools/utilsw/java] action create[2014-09-26T15:41:26-04:00] INFO: directory[/tools/utilsw/java] created directory /t                                                     ools/utilsw/java
==> default:
==> default:     - create new directory /tools/utilsw/java[2014-09-26T15:41:26-04:00] INFO: directory[/tools/utilsw/java] owner changed to 54322
==> default: [2014-09-26T15:41:26-04:00] INFO: directory[/tools/utilsw/java] group changed to 54324
==> default: [2014-09-26T15:41:26-04:00] INFO: directory[/tools/utilsw/java] mode changed to 755
==> default:
==> default:     - change mode from '' to '0755'
==> default:     - change owner from '' to 'orainst'
==> default:     - change group from '' to 'oraapps'
==> default:     - restore selinux security context
==> default:   * user[orainst] action create (up to date)
==> default:   * group[oraapps] action create (up to date)
==> default:   * directory[/tools/utilsw/java/jdk] action create[2014-09-26T15:41:26-04:00] INFO: directory[/tools/utilsw/java/jdk] created dire                                                     ctory /tools/utilsw/java/jdk
==> default:
==> default:     - create new directory /tools/utilsw/java/jdk[2014-09-26T15:41:26-04:00] INFO: directory[/tools/utilsw/java/jdk] owner changed                                                      to 54322
==> default: [2014-09-26T15:41:26-04:00] INFO: directory[/tools/utilsw/java/jdk] group changed to 54324
==> default: [2014-09-26T15:41:26-04:00] INFO: directory[/tools/utilsw/java/jdk] mode changed to 755
==> default:
==> default:     - change mode from '' to '0755'
==> default:     - change owner from '' to 'orainst'
==> default:     - change group from '' to 'oraapps'
==> default:     - restore selinux security context
==> default: Recipe: java::set_java_home
==> default:   * ruby_block[set-env-java-home] action run[2014-09-26T15:41:26-04:00] INFO: ruby_block[set-env-java-home] called
==> default:
==> default:     - execute the ruby block set-env-java-home
==> default:   * directory[/etc/profile.d] action create (up to date)
==> default:   * file[/etc/profile.d/jdk.sh] action create[2014-09-26T15:41:26-04:00] INFO: file[/etc/profile.d/jdk.sh] created file /etc/profil                                                     e.d/jdk.sh
==> default:
==> default:     - create new file /etc/profile.d/jdk.sh[2014-09-26T15:41:26-04:00] INFO: file[/etc/profile.d/jdk.sh] updated file contents /etc                                                     /profile.d/jdk.sh
==> default:
==> default:     - update content in file /etc/profile.d/jdk.sh from none to 26187d
==> default:     --- /etc/profile.d/jdk.sh      2014-09-26 15:41:26.000000000 -0400
==> default:     +++ /tmp/.jdk.sh20140926-4938-l1s7si   2014-09-26 15:41:26.000000000 -0400
==> default:     @@ -1 +1,2 @@
==> default:     +export JAVA_HOME=/usr/lib/jvm/java[2014-09-26T15:41:26-04:00] INFO: file[/etc/profile.d/jdk.sh] mode changed to 755
==> default:
==> default:     - change mode from '' to '0755'
==> default:     - restore selinux security context
==> default: Recipe: java::oracle
==> default:   * java_ark[jdk] action install[2014-09-26T15:41:27-04:00] INFO: Adding jdk to /usr/lib/jvm/jdk1.7.0_51
==> default:
==> default:     * remote_file[/var/chef/cache/jdk-7u51-linux-x64.gz] action create_if_missing[2014-09-26T15:41:27-04:00] INFO: remote_file[/var                                                     /chef/cache/jdk-7u51-linux-x64.gz] created file /var/chef/cache/jdk-7u51-linux-x64.gz
==> default:
==> default:       - create new file /var/chef/cache/jdk-7u51-linux-x64.gz[2014-09-26T15:41:32-04:00] INFO: remote_file[/var/chef/cache/jdk-7u51                                                     -linux-x64.gz] updated file contents /var/chef/cache/jdk-7u51-linux-x64.gz
==> default:
==> default:       - update content in file /var/chef/cache/jdk-7u51-linux-x64.gz from none to 77367c
==> default:       (file sizes exceed 10000000 bytes, diff output suppressed)[2014-09-26T15:41:33-04:00] INFO: remote_file[/var/chef/cache/jdk-7                                                     u51-linux-x64.gz] mode changed to 755
==> default:
==> default:       - change mode from '' to '0755'
==> default:       - restore selinux security context
==> default: [2014-09-26T15:41:33-04:00] FATAL:  Command ' mv "/var/chef/cache/jdk1.7.0_51" "/usr/lib/jvm/jdk1.7.0_51" ' failed
==> default:
==> default:     ================================================================================
==> default:     Error executing action `install` on resource 'java_ark[jdk]'
==> default:     ================================================================================
==> default:
==> default:     SystemExit
==> default:     ----------
==> default:     exit
==> default:
==> default:     Cookbook Trace:
==> default:     ---------------
==> default:     /var/chef/cache/cookbooks/java/providers/ark.rb:167:in `block (2 levels) in class_from_file'
==> default:     /var/chef/cache/cookbooks/java/providers/ark.rb:137:in `block in class_from_file'
==> default:
==> default:     Resource Declaration:
==> default:     ---------------------
==> default:     # In /var/chef/cache/cookbooks/java/recipes/oracle.rb
==> default:
==> default:      53: java_ark "jdk" do
==> default:      54:   url tarball_url
==> default:      55:   default node['java']['set_default']
==> default:      56:   checksum tarball_checksum
==> default:      57:   app_home java_home
==> default:      58:   bin_cmds bin_cmds
==> default:      59:   alternatives_priority node['java']['alternatives_priority']
==> default:      60:   retries node['java']['ark_retries']
==> default:      61:   retry_delay node['java']['ark_retry_delay']
==> default:      62:   action :install
==> default:      63: end
==> default:      64:
==> default:
==> default:     Compiled Resource:
==> default:     ------------------
==> default:     # Declared in /var/chef/cache/cookbooks/java/recipes/oracle.rb:53:in `from_file'
==> default:
==> default:     java_ark("jdk") do
==> default:       action [:install]
==> default:       supports {:report=>true, :exception=>true}
==> default:       retries 0
==> default:       retry_delay 2
==> default:       guard_interpreter :default
==> default:       cookbook_name "java"
==> default:       recipe_name "oracle"
==> default:       url "*** MASKED OUT ***"
==> default:       default true
==> default:       checksum "c523e7339d925c1e6c5994813f7c9e86"
==> default:       app_home "/usr/lib/jvm/java"
==> default:       bin_cmds ["appletviewer", "apt", "ControlPanel", "extcheck", "idlj", "jar", "jarsigner", "java", "javac", "javadoc", "javafxp                                                     ackager", "javah", "javap", "javaws", "jcmd", "jconsole", "jcontrol", "jdb", "jhat", "jinfo", "jmap", "jps", "jrunscript", "jsadebugd", "jstack"                                                     , "jstat", "jstatd", "jvisualvm", "keytool", "native2ascii", "orbd", "pack200", "policytool", "rmic", "rmid", "rmiregistry", "schemagen", "seria                                                     lver", "servertool", "tnameserv", "unpack200", "wsgen", "wsimport", "xjc"]
==> default:       alternatives_priority 1062
==> default:     end
==> default:
==> default: [2014-09-26T15:41:33-04:00] INFO: Running queued delayed notifications before re-raising exception
==> default:
==> default: Running handlers:
==> default: [2014-09-26T15:41:33-04:00] ERROR: Running exception handlers
==> default: Running handlers complete
==> default: [2014-09-26T15:41:33-04:00] ERROR: Exception handlers complete
==> default: [2014-09-26T15:41:33-04:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: Chef Client failed. 11 resources updated in 14.406755 seconds
==> default: [2014-09-26T15:41:33-04:00] INFO: Sending resource update report (run-id: c7af9cac-93e8-41c6-a79f-1b91d35d8332)
==> default: [2014-09-26T15:41:33-04:00] ERROR: java_ark[jdk] (java::oracle line 53) had an error: SystemExit: exit
==> default: [2014-09-26T15:41:33-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Add boolean toggle to download unlimited strength JCE policy files

As anyone who's using Jruby / Rails will know, when you invoke any form of crypto operation through your Rails server on a vanilla install of Oracle JVM, you will normally get the following error:

"OpenSSL::Cipher::CipherError: Illegal key size: possibly you need to install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for your JRE"

Running on a machine with an Oracle JVM provisioned using this cookbook is no exception, as the cookbook doesn't seem to do anything about these files when it runs the oracle installer.

Would it be possible to add a boolean toggle for the cookbook to automate obtaining these JCE jar files and installing them in the right place? It would default to false to stay in line with US export policy. I envisage it working much like the existing "java" => "oracle" => "accept_oracle_download_terms", so it could be called something like "java" => "oracle" => "accept_unlimited_strength_jce_download_terms".

I don't know if the other JVM variants (e.g. IBM's one) also have this restriction, but if they do, probably best to add it as a provider-specific option in each case, rather than a blanket parameter at the top level, because OpenJDK just seems to turn on unlimited strength crypto by default.

For additional brownie points, when the toggle is set to true, you could log out one of those scary legalese warnings saying that the user has explicitly chosen to turn on unlimited strength crypto, which may put them in violation of US export policy.

Drop support for JDK 6 (cookbook v2.0.0?)

Once support for JDK 8 is implemented ( #155 ), I'd like to think about making v2.0.0 of the cookbook deprecate JDK 6 and make JDK 7 the default version. This would also mean the purge_deprecated_packages recipe could clean up OpenJDK 6 and Oracle JDK 6.

Support for debian jessie

It's just doesn't work.

Compiling Cookbooks...

================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/java/recipes/default.rb
================================================================================


Chef::Exceptions::InvalidCookbookVersion
----------------------------------------
'jessie/sid' does not match 'x.y.z' or 'x.y'


Cookbook Trace:
---------------
  /var/chef/cache/cookbooks/java/recipes/set_attributes_from_version.rb:40:in `from_file'
  /var/chef/cache/cookbooks/java/recipes/default.rb:25:in `from_file'


Relevant File Content:
----------------------
/var/chef/cache/cookbooks/java/recipes/set_attributes_from_version.rb:

 33:    node.default['java']['openjdk_packages'] = ["openjdk#{node['java']['jdk_version']}"]
 34:  when "arch"
 35:    node.default['java']['java_home'] = "/usr/lib/jvm/java-#{node['java']['jdk_version']}-openjdk"
 36:    node.default['java']['openjdk_packages'] = ["openjdk#{node['java']['jdk_version']}"]
 37:  when "debian"
 38:    node.default['java']['java_home'] = "/usr/lib/jvm/java-#{node['java']['jdk_version']}-#{node['java']['install_flavor']}"
 39:    # Newer Debian & Ubuntu adds the architecture to the path
 40>>   if node['platform'] == 'debian' && Chef::VersionConstraint.new(">= 7.0").include?(node['platform_version']) ||
 41:       node['platform'] == 'ubuntu' && Chef::VersionConstraint.new(">= 12.04").include?(node['platform_version'])
 42:      node.default['java']['java_home'] = "#{node['java']['java_home']}-#{node['kernel']['machine'] == 'x86_64' ? 'amd64' : 'i386'}"
 43:    end
 44:    node.default['java']['openjdk_packages'] = ["openjdk-#{node['java']['jdk_version']}-jdk", "openjdk-#{node['java']['jdk_version']}-jre-headless"]
 45:  when "smartos"
 46:    node.default['java']['java_home'] = "/opt/local/java/sun6"
 47:    node.default['java']['openjdk_packages'] = ["sun-jdk#{node['java']['jdk_version']}", "sun-jre#{node['java']['jdk_version']}"]
 48:  when "windows"
 49:    # Do nothing otherwise we will fall through to the else and set java_home to an invalid path, causing the installer to popup a dialog




Running handlers:
[2014-04-08T03:30:18+00:00] ERROR: Running exception handlers
Running handlers complete

[2014-04-08T03:30:18+00:00] ERROR: Exception handlers complete
[2014-04-08T03:30:18+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 18.711022304 seconds
[2014-04-08T03:30:18+00:00] ERROR: 'jessie/sid' does not match 'x.y.z' or 'x.y'
[2014-04-08T03:30:18+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

java install fails with vagrant-cachier plugin and NFS sharing

DISCLAIMER - I'm a chef/vagrant newbie here

I'm using vagrant and chef-solo to setup consistent vm development environments. I need java and am using this plugin.

To improve performance of vagrant, I'm using two recommendations I found on the web:

  1. use vagrant NFS file sharing
  2. use vagrant-cachier plugin.

The benefit of using vagrant-cachier plugin is that your archives and packages downloaded from chef are stored in your user directory on the host system. This way, every time you 'vagrant up' a fresh system, you don't have to download everything if its sitting in your cache.

I'm told using NFS with vagrant improves performance as well and is recommended. The trouble is that when using this vagrant-cachier along with NFS, this causes the java chef recipe to fail.

The problem is that after the recipe successfully downloads the java archive into my cache directory, it tries to unpack it in the cache as well and this was failing for me with the following error message:

 FATAL: Failed to extract file jdk-7u51-linux-i586.tar.gz!

After troubleshooting the issue by printing the stderr from executing tar, I see the following:

[2014-04-11T01:20:24+00:00] INFO: cmd.stderr tar: jdk1.7.0_51/man/ja_JP.UTF-8/man1/rmid.1: Cannot change ownership to uid 10, gid 143: Operation not permitted

This occurs for every file in the archive.

It seems there are two solutions to this:

  1. In providers/ark.rb on line 154, include the "--no-same-owner" option to the tar command
  2. Don't try to unpack the downloaded archive in the same cache directory but perhaps in /tmp on the guest system.

In my local environment I chose the first suggestion and it resolved my issue.

As I explained in a previous issue ( #163 ), I'm a chef newbie at this point and not skilled enough at this point to complete the guidelines to submit a pull request, but if this issue remains open and I become season enough in chefspec and your integration test suite, I might give it a try.

In the meantime, thanks again for the great plugin.

Pin to a specific oracle jdk version

Hi,

As a reminder, the oracle_rpm recipe is aimed to install and configure Oracle jdk or jre package provided by a custom YUM repository. Oracle does not host such repository. It is up to you to initialize this YUM repo with the rpm downloaded from Oracle web site.

In the current version of the recipe, it is not foreseen to pin a specific version of the jre/jdk. It basically calls 'yum upgrade jre' or 'yum upgrade jdk', based on node['java']['oracle_rpm']['type']. Thus, it will install or upgrade to the up-to-date package available in the custom repository. It is assumed that this repository does not mix packages from different java major versions (1.6, 1.7), so that it is not necessary to specify a version in the recipe.

If you really need to manage precisely the version, please, feel free to submit a ticket.

Hope it clarifies.

Christophe

Le 20 juin 2014 11:06, "Garg, Saman" [email protected] a écrit :
Hi,

We downloaded the java cookbook from community and we tried to see if we could start using it without re-inventing the wheel. But we ran into some issues which we thought we should share with you and get feedback.
If those are real issues, you guys may help get improvements in future versions of the cookbook.

Requirement: To be able to pin jdk package install to a specific version of Oracle jdk.
Issue: In the below block of code from recipes/oracle_rpm.rb, it tries to set the commands based on jdk or jre using the attribute "case node['java']['oracle_rpm']['type']" and when it tries to install the package, it is using the same attribute "case node['java']['oracle_rpm']['type']" so it's not possible to pin it to a specific jdk version.

Am I missing something here OR this is something that is already in your enhancement pipeline?

======== FROM: recipes/oracle_rpm.rb ===============

slave_cmds = case node['java']['oracle_rpm']['type']
when 'jdk'
%W[appletviewer apt ControlPanel extcheck idlj jar jarsigner javac javadoc javafxpackager javah javap java-rmi.cgi javaws jcmd jconsole jcontrol jdb jhat jinfo jmap jps jrunscript jsadebugd jstack jstat jstatd jvisualvm keytool native2ascii orbd pack200 policytool rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc]
when 'jre'
%W[ControlPanel java_vm javaws jcontrol keytool orbd pack200 policytool rmid rmiregistry servertool tnameserv unpack200]
else
Chef::Application.fatal "Unsupported oracle RPM type (#{node['java']['oracle_rpm']['type']})"
end

package node['java']['oracle_rpm']['type'] do
action :upgrade
notifies :run, 'bash[update-java-alternatives]', :immediately if platform_family?('rhel', 'fedora') and node['java']['set_default']
end

==================================================

First Provision - Not Installing Right Java Version

After provisioning with this cookbook, java -version is showing the base box's Java 1.5 even though I've specified openjdk 7.

Berksfile
cookbook 'java'

kitchen.yml # using test-kitchen

      'java': {
        'install_flavor': 'openjdk',
        'jdk_version': '7'
      }

Then, after provisioning:

$ java -version
java version "1.5.0"
gij (GNU libgcj) version 4.4.7 20120313 (Red Hat 4.4.7-4)

Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

But, if I provision once more, java -version points to the correct version.

Why is the correct version of java not getting installed on the first provision?

Provide a simpler way to determine path of primary cacert

I've been struggling a bit trying to find the easiest and most cross platform appropriate way to find the path of the primary cacert. This is normally $JAVA_HOME/jre/lib/security/cacert, but not always.

For instance, on Centos 6.4 this ends up being $JAVA_HOME/jre-openjdk/lib/security/cacert. It would be great if this cookbook provided this.

Setting JAVA_HOME on the Java Cookbook

With vagrant + vagrant-berkshelf, using the Java Cookbook (http://community.opscode.com/cookbooks/java), I'm trying to specify the location of my jdk installation.

I'd like to set my JAVA_HOME to /foo/bar. In other words, I'd like to have java installed in foo/bar.

I tried to do this by modifying the java_home attribute in my Vagrantfile:

  config.vm.provision :chef_solo do |chef|
        "java" => {
          "install_flavor" => "oracle",
          "jdk_version" => "7",
          "java_home" => "/foo/java",
          "oracle" => {
            "accept_oracle_download_terms" => true
          }
        }

Here's the result:

[vagrant@vagrant-centos65 ~]$ ls -lrot /foo
lrwxrwxrwx 1 vagrant    0 Mar 20 18:31 java -> /foo/jdk1.7.0_51

It looks like my attempt at setting JAVA_HOME in order to specify the jdk download directory did not work.

What do I need to do to change the jdk installation? I'm not looking for simply a symbolic link.

Thanks for your help and your cookbook!

Setup Windows Integration test suite

I'm not familiar with how to setup or test on Windows with Chef.

If possible, setup a .kitchen_windows.yml with azure driver that provisions Windows machines and runs Serverspec (or whatever windows uses for integration testing)

We have free credit on Azure, so no need for any keys. If this is provided we'll run before every release.

Edit: Kitchen does not support Windows guests yet, so maybe a different driver?
Notes:

Resource ark -> attribute bin_cmds default value

Hi there,

I think the attribute bin_cmds should be a empty array as default value
https://github.com/agileorbit/java/blob/master/resources/ark.rb#L39

  * template[/opt/.java8_alt.jinfo] action create
    - create new file /opt/.java8_alt.jinfo
================================================================================
Error executing action `create` on resource 'template[/opt/.java8_alt.jinfo]'
================================================================================


Chef::Mixin::Template::TemplateError
------------------------------------
undefined method `each' for nil:NilClass


Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/java/providers/ark.rb

178:       template jinfo_file do
179:         cookbook "java"
180:         source "oracle.jinfo.erb"
181:         variables(
182:           :priority => new_resource.alternatives_priority,
183:           :bin_cmds => new_resource.bin_cmds,
184:           :name => java_name,
185:           :app_dir => app_home
186:         )
187:         action :create
188:       end
189:     end



Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/java/providers/ark.rb:178:in `block (2 levels) in class_from_file'

template("/opt/.java8_alt.jinfo") do
  provider Chef::Provider::Template
  action [:create]
  retries 0
  retry_delay 2
  guard_interpreter :default
  path "/opt/.java8_alt.jinfo"
  backup 5
  atomic_update true
  source "oracle.jinfo.erb"
  cookbook "java"
  variables {:priority=>1208, :bin_cmds=>nil, :name=>"java8_alt", :app_dir=>"/opt/java8_alt"}
  cookbook_name "fiduceo_java"
end



Template Context:
-----------------
on line #5
  3: section=main
  4:
  5: <% @bin_cmds.each do |cmd| -%>jdk <%= cmd %> <%= @app_dir %>/bin/<%= cmd %>
  6: <% end -%>


Not working on Debian wheezy 7.3

[2014-01-18T00:05:22+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2014-01-18T00:05:22+00:00] ERROR: Cannot find a resource for include on debian version 7.3

Recipe Compile Error in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rcombo/recipes/default.rb

NameError

Cannot find a resource for include on debian version 7.3

Cookbook Trace:

/tmp/vagrant-chef-1/chef-solo-1/cookbooks/rcombo/recipes/default.rb:10:in `from_file'

Relevant File Content:

/tmp/vagrant-chef-1/chef-solo-1/cookbooks/rcombo/recipes/default.rb:

3: # Recipe:: default
4: #
5: # Copyright 2014, YOUR_COMPANY_NAME
6: #
7: # All rights reserved - Do Not Redistribute
8: #
9:
10>> include "java"
11: node['java']['oracle']['accept_oracle_download_terms'] = true
12: node['java']['install_flavor'] = "oracle"

Way to install multiple JDKs with different versions

Sorry if this is already possible; I couldn't see a way to do it though.

I'm setting up a build server and need both jdk 6 and jdk 7 (and very soon 8) installed, as we have projects that build and run with older JDKs.

In theory I could run the recipes more than once, but the java version is a node-global attribute. Is there any way to do this without having to fall back to using the java_ark resource and specifying the urls, checksums etc myself in a custom recipe?

Thanks

cookbook doesnt work for jdk 7_u51

* remote_file[/var/chef/cache/jdk-7u51-linux-x64.gz] action create_if_missing (up to date)

[2014-09-26T18:09:41-04:00] FATAL: Command ' mv "/var/chef/cache/jdk1.7.0_51" "/tools/utilsw/jdk1.7.0_51" ' failed

Refactor this cookbook in terms of LWRPs

As a user, I should be able to install any permutation of JDKs/JREs on a node, whether they be official Sun/Oracle builds, IBM builds or OpenJDK builds, into any directory that can be specified as a JAVA_HOME.

As currently designed, this cookbook cannot provide this functionality, because it uses recipes instead of LWRPs. The user is therefore currently limited to installing one of each "flavor" provided by a given recipe. (The exception is any Java provided by the java_ark provider, but this should be the rule, not the exception.)

Rewrite ChefSpec tests

After the refactor for 1.19.0, these will fail. I don't have the time to refactor right now, so help is very much appreciated.

Unable to install jdk 7 on windows 7

I am running chef solo on my local windows 7 box and trying to install jdk 7u51. I have created a json file for a role named jdk7 as following -
{
"name" : "jdk7",
"description" : "JDK 7",

"json_class" : "Chef::Role",
"chef_type" : "role",

"default_attributes" : {
    "java" : {
        "install_flavor" : "oracle",
        "jdk_version" : "7", 
        "windows" : {
            "url" : "file:///D:/Downloads/java/jdk-7u51-windows-x64.exe"
        },
        "oracle": {
          "accept_oracle_download_terms": true
        }
    }
},

"run_list": [
    "recipe[java]"
]

}

Here is the content of node.json (node configuration file) -

{
"run_list": [
"role[jdk7]"
]
}

However when I am running chef solo, I am getting following error -

Running handlers:
[2014-06-06T12:23:28+05:30] ERROR: Running exception handlers
Running handlers complete
[2014-06-06T12:23:28+05:30] ERROR: Exception handlers complete
[2014-06-06T12:23:28+05:30] FATAL: Stacktrace dumped to D:/Shailendra/git-repos/chef-solo-windows/.chef/chef-stacktrace.out
Chef Client failed. 1 resources updated in 8.91051 seconds
[2014-06-06T12:23:29+05:30] FATAL: Chef::Exceptions::EnclosingDirectoryDoesNotExist: directory[/etc/profile.d](java::set_java_hom
e line 26) had an error: Chef::Exceptions::EnclosingDirectoryDoesNotExist: Parent directory /etc does not exist, cannot create /et
c/profile.d

Can this cookbook be used to install/upgrade jdk on windows 7? I am using 1.22.0 version of this cookbook.

On Ubuntu 14 LTS update-alternatives seems to fail

I'm trying to install Oracle Java 8 with the following configuration to Ubuntu 14.04.1 LTS x86_64 (downloaded from https://cloud-images.ubuntu.com/):

"default_attributes": {
    "java": {
      "install_flavor": "oracle",
      "jdk_version": "8",
      "oracle": {
        "accept_oracle_download_terms": true
      }
    }
}

After Chef has done provisioning, I check Java version which incorrectly points to OpenJDK Java 7:

$ java -version
java version "1.7.0_55"
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

If I run $ sudo update-alternatives --config java I see that OpenJDK is still incorrectly set to default:

$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      auto mode
  1            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      manual mode
  2            /usr/lib/jvm/java-8-oracle-amd64/bin/java        1062      manual mode

... but then again JAVA_HOME is pointing to correct location:

$ echo $JAVA_HOME
/usr/lib/jvm/java-8-oracle-amd64

Of course I can fix this manually by setting:

$ sudo update-alternatives --set java $JAVA_HOME/bin/java

... but it would be nice if this would be fixed directly to the cookbook :)

Unable to install Oracle Java 7 on Debian 7.6

Hello,

My apologies if this is an error caused by my lack of understanding (I'm very new to Chef). However, I am getting the following error when trying to install Oracle 7:

Recipe: java::oracle
  * java_ark[jdk] action install[2014-10-02T12:39:58+00:00] FATAL: Failed to extract file jdk-7u67-linux-x64.tar.gz!
  ================================================================================
    Error executing action `install` on resource 'java_ark[jdk]'
    ================================================================================

    SystemExit
    ----------
    exit

    Cookbook Trace:
    ---------------
    /vagrant/chef-repo/cookbooks/java/providers/ark.rb:164:in `block (2 levels) in class_from_file'
    /vagrant/chef-repo/cookbooks/java/providers/ark.rb:142:in `block in class_from_file'

    Resource Declaration:
    ---------------------
    # In /vagrant/chef-repo/cookbooks/java/recipes/oracle.rb

     53: java_ark "jdk" do
     54:   url tarball_url
     55:   default node['java']['set_default']
     56:   checksum tarball_checksum
     57:   app_home java_home
     58:   bin_cmds bin_cmds
     59:   alternatives_priority node['java']['alternatives_priority']
     60:   retries node['java']['ark_retries']
     61:   retry_delay node['java']['ark_retry_delay']
     62:   action :install
     63: end
     64:

    Compiled Resource:
    ------------------
    # Declared in /vagrant/chef-repo/cookbooks/java/recipes/oracle.rb:53:in `from_file'

    java_ark("jdk") do
      action [:install]
      supports {:report=>true, :exception=>true}
      retries 0
      retry_delay 2
      guard_interpreter :default
      cookbook_name :java
      recipe_name "oracle"
      url "http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-x64.tar.gz"
      default true
      checksum "81e3e2df33e13781e5fac5756ed90e67"
      app_home "/usr/lib/jvm/java-7-oracle-amd64"
      bin_cmds ["appletviewer", "apt", "ControlPanel", "extcheck", "idlj", "jar", "jarsigner", "java", "javac", "javadoc", "javafxpackager", "javah", "javap", "javaws", "jcmd", "jconsole", "jcontrol",
 "jdb", "jhat", "jinfo", "jmap", "jps", "jrunscript", "jsadebugd", "jstack", "jstat", "jstatd", "jvisualvm", "keytool", "native2ascii", "orbd", "pack200", "policytool", "rmic", "rmid", "rmiregistry",
"schemagen", "serialver", "servertool", "tnameserv", "unpack200", "wsgen", "wsimport", "xjc"]
      alternatives_priority 1062
      owner "root"
    end

I am using a Vagrant box with Chef Solo, version 11.16.2 installed. I've uploaded the sample recipe that I built here: http://tempsend.com/2C5003429D

Thanks in advance.

Problem with providers/alternatives.rb

Hi,
I'm having problems with alternatives on my vagrant box.

The VM is taken from here: "http://opscode-vagrant-boxes.s3.amazonaws.com/centos5-gems.box" (also had the same problem with another centos 5 image). I'm using chef_solo.

    chef.json = { :run_list => [ "recipe[java]" ],
     :java => {
       :jdk_version => 6,
       :install_flavor => "openjdk"
     }

How to reproduce:
1 - vagrant up
2 - vagrant provision

The second time provisioning runs you'll get this error:

...
[2014-02-07T11:11:30+00:00] DEBUG: Adding alternative for appletviewer
[2014-02-07T11:11:30+00:00] DEBUG: Setting alternative for appletviewer                                                                                                                                
[2014-02-07T11:11:30+00:00] FATAL:  set alternative failed
================================================================================                                                                                                                       
Error executing action `set` on resource 'java_alternatives[set-java-alternatives]'                                                                                                                    
================================================================================
...

I think the problem is due to the way "alternatives" behave when using "--install":

[vagrant@vagrant-c5-x86_64 ~]$ /usr/sbin/alternatives --version
alternatives version 1.3.30.2
[vagrant@vagrant-c5-x86_64 ~]$ sudo su -
[root@vagrant-c5-x86_64 ~]# /usr/sbin/alternatives --install /usr/bin/appletviewer appletviewer /usr/lib/jvm/java-1.6.0/bin/appletviewer 1061 
failed to read link /usr/bin/appletviewer: No such file or directory
[root@vagrant-c5-x86_64 ~]# echo $?
0

Support JDK 8 on platforms other than Oracle

Thanks to #147, the cookbook installs JDK 8 on Oracle. OpenJDK 8 builds have not yet been pushed to the various platform repositories, which means we don't yet have a method for installation on other platforms. Should we consider an alternative package repository for each platform? #149 suggests one for Ubuntu, but I think maintaining cookbook logic for each platform would become cumbersome.

I'd like to add support for JDK 8 sooner rather than later, so we can prepare v2.0.0 of the cookbook which will drop support for JDK 6 and install JDK 7 by default.

downloading oracle tarball fails on curl with 18 status code

Hi

Occasionally I'm seeing following error during provisioning vagrant with java cookbook:

chef-stacktrace.out:

Generated at 2014-04-14 16:18:36 +0000
Mixlib::ShellOut::ShellCommandFailed: java_ark[jdk] (java::oracle line 53) had an error: 
Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '18'

Ran  curl --create-dirs -L --cookie "oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz -o /var/chef/cache/jdk-7u51-linux-x64.tar.gz  returned 18

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.3.0/lib/mixlib/shellout.rb:253:in `invalid!'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.3.0/lib/mixlib/shellout.rb:239:in `error!'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.10.4/lib/chef/mixin/shell_out.rb:45:in `shell_out!'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb:81:in `block in download_direct_from_oracle'

Full stack trace is available here.

It seems that sometimes curl is returning status code 18. I've found that someone had similar issue.

I guess this can be server/network issue, however it would be nice if java cookbook handled this situation in better way:

Attribute 'url' is not respected for oracle's jdk

Hi,
I am writing wrapper cookbook for the 'nexus' cookbook. I want to install latest version of oracle's jdk7 (7u60). I added following to my attributes/default.rb

force_override['java']['jdk_version']='7'
force_override['java']['install_flavor'] = 'oracle'
force_override['java']['oracle']['accept_oracle_download_terms'] = true
force_override['java']['oracle']['url'] = 'http://download.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-linux-x64.tar.gz'

However it keeps installed 7u51 version

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.