2014년 11월 26일 수요일

Cookbook application_java and workaround to the error - undefined method 'create' for nil:NilClass

These days, I developed cookbooks to deploy java web applications. To do this efficiently, need to combine some cookbooks: java, tomcat and application_java. As what they intend to do by their names, they certainly install and configure software related to java (JDK, java container server and java application).

Developing java and tomcat cookbook wasn't a big deal, but, I encountered problem with an error in case of application_java. My code was follows:
include_recipe 'java'

application 'shop-admin' do
    path '/var/shop-admin'
    repository 'http://192.168.56.170/zabbix/shop.admin.war'
    revision '1.0'
    scm_provider Chef::Provider::RemoteFile::Deploy

    java_webapp
    tomcat
end
My error message was:
...
================================================================================
Error executing action `deploy` on resource 'deploy_revision[shop-admin]'
================================================================================

NoMethodError
-------------
undefined method `create' for nil:NilClass

Cookbook Trace:
---------------
/var/chef/cache/cookbooks/application_java/libraries/provider_remote_file_deploy.rb:53:in `action_sync'
...
The solution was to change application_java cookbook. By default, Chef Supermarket links to https://github.com/poise/application_java.

Other people who had same issue already posted and someone recommended to clone from https://github.com/jamiely/application_java
I replaced with "jamiely/application_java". After that, my war deployed well.

댓글 없음:

댓글 쓰기