[chef] Re: Re: Re: Re: Re: Re: Re: Re: Recipe application does not work because chef_envronment is not defined


Chronological Thread 
  • From: "Jesus M. Movilla" < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Re: Re: Re: Re: Recipe application does not work because chef_envronment is not defined
  • Date: Thu, 12 Apr 2012 12:23:27 +0200

Hi Andrea

You are completely right. It was missing "tomcat" cookbook in the type attribute of the databag.

Everything worked fine excepto with the tomcat cookbook. The process of starting tomcat gives back the following error.

[Thu, 12 Apr 2012 12:18:34 +0200] DEBUG: service[tomcat] runlevel 5, action start, priority 92
[Thu, 12 Apr 2012 12:18:34 +0200] DEBUG: Executing /usr/sbin/invoke-rc.d tomcat6 start
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: ---- Begin output of /usr/sbin/invoke-rc.d tomcat6 start ----
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: STDOUT:  * Starting Tomcat servlet engine tomcat6
   ...fail!
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: STDERR: invoke-rc.d: initscript tomcat6, action "start" failed.
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: ---- End output of /usr/sbin/invoke-rc.d tomcat6 start ----
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: Ran /usr/sbin/invoke-rc.d tomcat6 start returned 1
[Thu, 12 Apr 2012 12:18:39 +0200] ERROR: service[tomcat] (tomcat::default line 42) has had an error
[Thu, 12 Apr 2012 12:18:39 +0200] ERROR: service[tomcat] (/var/cache/chef/cookbooks/tomcat/recipes/default.rb:42:in `from_file') had an error:
service[tomcat] (tomcat::default line 42) had an error: Chef::Exceptions::Exec: /usr/sbin/invoke-rc.d tomcat6 start returned 1, expected 0
---- Begin output of /usr/sbin/invoke-rc.d tomcat6 start ----
STDOUT:  * Starting Tomcat servlet engine tomcat6
   ...fail!STDERR: invoke-rc.d: initscript tomcat6, action "start" failed.
---- End output of /usr/sbin/invoke-rc.d tomcat6 start ----

/usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:127:in `handle_command_failures'
/usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:74:in `run_command'
/usr/lib/ruby/vendor_ruby/chef/provider/service/init.rb:37:in `start_service'
/usr/lib/ruby/vendor_ruby/chef/provider/service.rb:57:in `action_start'
/usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in `send'
/usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in `run_action'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:45:in `run_action'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in `converge'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in `each'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in `converge'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94:in `execute_each_resource'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in `call'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:in `step'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:in `execute_each_resource'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:76:in `converge'
/usr/lib/ruby/vendor_ruby/chef/client.rb:312:in `converge'
/usr/lib/ruby/vendor_ruby/chef/client.rb:160:in `run'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:239:in `run_application'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in `loop'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in `run_application'
/usr/lib/ruby/vendor_ruby/chef/application.rb:67:in `run'
/usr/bin/chef-client:25
[Thu, 12 Apr 2012 12:18:39 +0200] ERROR: Running exception handlers
[Thu, 12 Apr 2012 12:18:39 +0200] FATAL: Saving node information to /var/cache/chef/failed-run-data.json
[Thu, 12 Apr 2012 12:18:39 +0200] ERROR: Exception handlers complete
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: Re-raising exception: Chef::Exceptions::Exec - service[tomcat] (tomcat::default line 42) had an error: Chef::Exceptions::Exec: /usr/sbin/invoke-rc.d tomcat6 start returned 1, expected 0
---- Begin output of /usr/sbin/invoke-rc.d tomcat6 start ----
STDOUT:  * Starting Tomcat servlet engine tomcat6
   ...fail!STDERR: invoke-rc.d: initscript tomcat6, action "start" failed.
---- End output of /usr/sbin/invoke-rc.d tomcat6 start ----

/usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:127:in `handle_command_failures'
  /usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:74:in `run_command'
  /usr/lib/ruby/vendor_ruby/chef/provider/service/init.rb:37:in `start_service'
  /usr/lib/ruby/vendor_ruby/chef/provider/service.rb:57:in `action_start'
  /usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in `send'
  /usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in `run_action'
  /usr/lib/ruby/vendor_ruby/chef/runner.rb:45:in `run_action'
  /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in `converge'
  /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in `each'
  /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in `converge'
  /usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94:in `execute_each_resource'
  /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in `call'
  /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
  /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:in `step'
  /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
  /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
  /usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:in `execute_each_resource'
  /usr/lib/ruby/vendor_ruby/chef/runner.rb:76:in `converge'
  /usr/lib/ruby/vendor_ruby/chef/client.rb:312:in `converge'
  /usr/lib/ruby/vendor_ruby/chef/client.rb:160:in `run'
  /usr/lib/ruby/vendor_ruby/chef/application/client.rb:239:in `run_application'
  /usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in `loop'
  /usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in `run_application'
  /usr/lib/ruby/vendor_ruby/chef/application.rb:67:in `run'
  /usr/bin/chef-client:25
[Thu, 12 Apr 2012 12:18:39 +0200] FATAL: Stacktrace dumped to /var/cache/chef/chef-stacktrace.out
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: Chef::Exceptions::Exec: service[tomcat] (tomcat::default line 42) had an error: Chef::Exceptions::Exec: /usr/sbin/invoke-rc.d tomcat6 start returned 1, expected 0
---- Begin output of /usr/sbin/invoke-rc.d tomcat6 start ----
STDOUT:  * Starting Tomcat servlet engine tomcat6
   ...fail!STDERR: invoke-rc.d: initscript tomcat6, action "start" failed.
---- End output of /usr/sbin/invoke-rc.d tomcat6 start ----

/usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:127:in `handle_command_failures'
/usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:74:in `run_command'
/usr/lib/ruby/vendor_ruby/chef/provider/service/init.rb:37:in `start_service'
/usr/lib/ruby/vendor_ruby/chef/provider/service.rb:57:in `action_start'
/usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in `send'
/usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in `run_action'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:45:in `run_action'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in `converge'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in `each'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in `converge'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94:in `execute_each_resource'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in `call'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:in `step'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:in `execute_each_resource'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:76:in `converge'
/usr/lib/ruby/vendor_ruby/chef/client.rb:312:in `converge'
/usr/lib/ruby/vendor_ruby/chef/client.rb:160:in `run'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:239:in `run_application'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in `loop'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in `run_application'
/usr/lib/ruby/vendor_ruby/chef/application.rb:67:in `run'
/usr/bin/chef-client:25
[Thu, 12 Apr 2012 12:18:39 +0200] FATAL: Chef::Exceptions::Exec: service[tomcat] (tomcat::default line 42) had an error: Chef::Exceptions::Exec: /usr/sbin/invoke-rc.d tomcat6 start returned 1, expected 0
---- Begin output of /usr/sbin/invoke-rc.d tomcat6 start ----
STDOUT:  * Starting Tomcat servlet engine tomcat6
   ...fail!STDERR: invoke-rc.d: initscript tomcat6, action "start" failed.
---- End output of /usr/sbin/invoke-rc.d tomcat6 start ----


However, the tomcat is up and running and the war application can be accessed at http://<ip>:8080/ since it is described in ROOT.xml

Should I start another issue with the tmcat cookbook or remain here?

Thanks a lot for your help!

On Wed, Apr 11, 2012 at 3:37 PM, Andrea Campi < "> > wrote:
On Wed, Apr 11, 2012 at 3:19 PM, Jesus M. Movilla
< "> > wrote:
> Hi Adrea, all
>
> Thanks for your previous reply.
>
> I decided to remove the content of the attribute "packages" (as you said) to
> avoid the above problem and I got finnally the cookbook executed without
> errors but I can not see any tomcat installed. All that I can see is an
> structure of directories that have been created in the directory specified
> in "deploy_to" all of them empty except releases that contains the war
> specified in "source" but with the name that has been specified in
> "checksum"...
>
> I guess something is wrong... What is supposed to do the java_webapp.rb and
> the corresponding java_app.json recipe and data_bag?, Should not end this
> story with a war deployed in a tomcat?

Does your data bag contain tomcat too?

 "type": {
   "my_app": [   <— with your app name, of course
     "java_webapp",
     "tomcat"
   ]
 },

If so, you should also have a ROOT.xml file in your Tomcat context
directory, and it should contain the name of your war file.

But since you say Tomcat was not installed, I supposed you don't. Try with that.

Andrea





Archive powered by MHonArc 2.6.16.

§