Problem deploying Java app

Hi all!

I’ve been lurking in this mailing list for over a year and this is my first
time posting here.
Anyway, I was trying to setup a demo Java environment using this tutorial:
http://blog.jamie.ly/programming/2014/03/06/deploying-a-java-tomcat-application-via-chef.html

The problem is that when I try to bootstrap the node I get the following
errors.
I’m also curious of how other companies are deploying Java apps - are you using
the application_java cookbook or some other mechanism?

================================================================================
Error executing action before_deploy on resource
’application_java_tomcat[jaxrs_tutorial]’

Chef::Exceptions::ResourceNotFound

Cannot find a resource matching service[tomcat] (did you define it first?)

Cookbook Trace:

/var/chef/cache/cookbooks/application_java/providers/tomcat.rb:48:in block (2 levels) in class_from_file' /var/chef/cache/cookbooks/application_java/providers/tomcat.rb:46:inblock in
class_from_file’
/var/chef/cache/cookbooks/application/providers/default.rb:110:in block (3 levels) in before_deploy' /var/chef/cache/cookbooks/application/providers/default.rb:109:ineach’
/var/chef/cache/cookbooks/application/providers/default.rb:109:in `block (2
levels) in before_deploy’

Resource Declaration:

In /var/chef/cache/cookbooks/application/resources/default.rb

115: resource = super(resource_name.to_sym, self.name, &block)
116: break

Compiled Resource:

Declared in /var/chef/cache/cookbooks/application/resources/default.rb:115:in

`block in method_missing’

application_java_tomcat(“jaxrs_tutorial”) do
action [:nothing]
retries 0
retry_delay 2
cookbook_name "jaxrs_tutorial"
recipe_name "default"
type :tomcat
restart_command
#Proc:0x000000035134e0@/var/chef/cache/cookbooks/application_java/providers/tomcat.rb:27
end

================================================================================
Error executing action run on resource ‘ruby_block[jaxrs_tutorial
before_deploy]’

Chef::Exceptions::ResourceNotFound

application_java_tomcat[jaxrs_tutorial] (jaxrs_tutorial::default line 115) had
an error: Chef::Exceptions::ResourceNotFound: Cannot find a resource matching
service[tomcat] (did you define it first?)

Cookbook Trace:

/var/chef/cache/cookbooks/application_java/providers/tomcat.rb:48:in block (2 levels) in class_from_file' /var/chef/cache/cookbooks/application_java/providers/tomcat.rb:46:inblock in
class_from_file’
/var/chef/cache/cookbooks/application/providers/default.rb:110:in block (3 levels) in before_deploy' /var/chef/cache/cookbooks/application/providers/default.rb:109:ineach’
/var/chef/cache/cookbooks/application/providers/default.rb:109:in `block (2
levels) in before_deploy’

Resource Declaration:

In /var/chef/cache/cookbooks/application/providers/default.rb

107: ruby_block “#{new_resource.name} before_deploy” do
108: block do
109: new_resource.sub_resources.each do |resource|
110: resource.run_action :before_deploy
111: end
112: callback(:before_deploy, new_resource.before_deploy)
113: end
114: end
115: end

Compiled Resource:

Declared in /var/chef/cache/cookbooks/application/providers/default.rb:107:in

`before_deploy’

ruby_block(“jaxrs_tutorial before_deploy”) do
action "run"
retries 0
retry_delay 2
block_name "jaxrs_tutorial before_deploy"
cookbook_name "jaxrs_tutorial"
block
#Proc:0x00000003466538@/var/chef/cache/cookbooks/application/providers/default.rb:108
end

Thanks and Regards,
Oliver Naaris

We wrote our own cookbook to install our java applications. Our opinion was that the open source cookbooks we could have used tried to do too much. So we wrote our own that was much more targeted to our needs.

I haven’t used any of the cookbooks referenced in that blog post. But the error below reference different line numbers than the latest version of the application cookbook on github - GitHub - poise/application: A Chef cookbook to deploy applications. https://github.com/poise/application

Can you update your cookbooks to the latest version and try again? Maybe there was a bug in an old version.

-T

On Oct 30, 2014, at 12:24 AM, oliver.naaris@gmail.com wrote:

Hi all!

I've been lurking in this mailing list for over a year and this is my first
time posting here.
Anyway, I was trying to setup a demo Java environment using this tutorial:
Deploying a Java Tomcat Application via Chef

The problem is that when I try to bootstrap the node I get the following
errors.
I'm also curious of how other companies are deploying Java apps - are you using
the application_java cookbook or some other mechanism?

================================================================================
Error executing action before_deploy on resource
'application_java_tomcat[jaxrs_tutorial]'

Chef::Exceptions::ResourceNotFound

Cannot find a resource matching service[tomcat] (did you define it first?)

Cookbook Trace:

/var/chef/cache/cookbooks/application_java/providers/tomcat.rb:48:in block (2 levels) in class_from_file' /var/chef/cache/cookbooks/application_java/providers/tomcat.rb:46:in block in
class_from_file'
/var/chef/cache/cookbooks/application/providers/default.rb:110:in block (3 levels) in before_deploy' /var/chef/cache/cookbooks/application/providers/default.rb:109:in each'
/var/chef/cache/cookbooks/application/providers/default.rb:109:in `block (2
levels) in before_deploy'

Resource Declaration:

In /var/chef/cache/cookbooks/application/resources/default.rb

115: resource = super(resource_name.to_sym, self.name, &block)
116: break

Compiled Resource:

Declared in /var/chef/cache/cookbooks/application/resources/default.rb:115:in

`block in method_missing'

application_java_tomcat("jaxrs_tutorial") do
action [:nothing]
retries 0
retry_delay 2
cookbook_name "jaxrs_tutorial"
recipe_name "default"
type :tomcat
restart_command
#Proc:0x000000035134e0@/var/chef/cache/cookbooks/application_java/providers/tomcat.rb:27
end

================================================================================
Error executing action run on resource 'ruby_block[jaxrs_tutorial
before_deploy]'

Chef::Exceptions::ResourceNotFound

application_java_tomcat[jaxrs_tutorial] (jaxrs_tutorial::default line 115) had
an error: Chef::Exceptions::ResourceNotFound: Cannot find a resource matching
service[tomcat] (did you define it first?)

Cookbook Trace:

/var/chef/cache/cookbooks/application_java/providers/tomcat.rb:48:in block (2 levels) in class_from_file' /var/chef/cache/cookbooks/application_java/providers/tomcat.rb:46:in block in
class_from_file'
/var/chef/cache/cookbooks/application/providers/default.rb:110:in block (3 levels) in before_deploy' /var/chef/cache/cookbooks/application/providers/default.rb:109:in each'
/var/chef/cache/cookbooks/application/providers/default.rb:109:in `block (2
levels) in before_deploy'

Resource Declaration:

In /var/chef/cache/cookbooks/application/providers/default.rb

107: ruby_block "#{new_resource.name} before_deploy" do
108: block do
109: new_resource.sub_resources.each do |resource|
110: resource.run_action :before_deploy
111: end
112: callback(:before_deploy, new_resource.before_deploy)
113: end
114: end
115: end

Compiled Resource:

Declared in /var/chef/cache/cookbooks/application/providers/default.rb:107:in

`before_deploy'

ruby_block("jaxrs_tutorial before_deploy") do
action "run"
retries 0
retry_delay 2
block_name "jaxrs_tutorial before_deploy"
cookbook_name "jaxrs_tutorial"
block
#Proc:0x00000003466538@/var/chef/cache/cookbooks/application/providers/default.rb:108
end

Thanks and Regards,
Oliver Naaris

Hi Tyler and thanks for the response

It took me half a day but I manged to figure out that the Tomcat 0.16.x
cookbook introduced some breaking changes that caused this problem. For
the moment I fixed the version number to 0.15.12 and it works. However
the java application deployment cookbook seems kinda broken at times. I
really wish that someone publishes a better version at Github.

Thanks again
Oliver

On 30/10/14 19:08, Tyler wrote:

We wrote our own cookbook to install our java applications. Our
opinion was that the open source cookbooks we could have used tried to
do too much. So we wrote our own that was much more targeted to our
needs.

I haven’t used any of the cookbooks referenced in that blog post. But
the error below reference different line numbers than the latest
version of the application cookbook on github -
GitHub - poise/application: A Chef cookbook to deploy applications.

Can you update your cookbooks to the latest version and try again?
Maybe there was a bug in an old version.

-T

On Oct 30, 2014, at 12:24 AM, oliver.naaris@gmail.com
mailto:oliver.naaris@gmail.com wrote:

Hi all!

I've been lurking in this mailing list for over a year and this is my
first
time posting here.
Anyway, I was trying to setup a demo Java environment using this
tutorial:
http://blog.jamie.ly/programming/2014/03/06/deploying-a-java-tomcat-application-via-chef.html

The problem is that when I try to bootstrap the node I get the following
errors.
I'm also curious of how other companies are deploying Java apps - are
you using
the application_java cookbook or some other mechanism?

================================================================================
Error executing action before_deploy on resource
'application_java_tomcat[jaxrs_tutorial]'

Chef::Exceptions::ResourceNotFound

Cannot find a resource matching service[tomcat] (did you define it
first?)

Cookbook Trace:

/var/chef/cache/cookbooks/application_java/providers/tomcat.rb:48:in
block (2 levels) in class_from_file' /var/chef/cache/cookbooks/application_java/providers/tomcat.rb:46:in block in
class_from_file'
/var/chef/cache/cookbooks/application/providers/default.rb:110:in
block (3 levels) in before_deploy' /var/chef/cache/cookbooks/application/providers/default.rb:109:in each'
/var/chef/cache/cookbooks/application/providers/default.rb:109:in
`block (2
levels) in before_deploy'

Resource Declaration:

In /var/chef/cache/cookbooks/application/resources/default.rb

115: resource = super(resource_name.to_sym, self.name, &block)
116: break

Compiled Resource:

Declared in

/var/chef/cache/cookbooks/application/resources/default.rb:115:in
`block in method_missing'

application_java_tomcat("jaxrs_tutorial") do
action [:nothing]
retries 0
retry_delay 2
cookbook_name "jaxrs_tutorial"
recipe_name "default"
type :tomcat
restart_command
#Proc:0x000000035134e0@/var/chef/cache/cookbooks/application_java/providers/tomcat.rb:27
end

================================================================================
Error executing action run on resource 'ruby_block[jaxrs_tutorial
before_deploy]'

Chef::Exceptions::ResourceNotFound

application_java_tomcat[jaxrs_tutorial] (jaxrs_tutorial::default line
115) had
an error: Chef::Exceptions::ResourceNotFound: Cannot find a resource
matching
service[tomcat] (did you define it first?)

Cookbook Trace:

/var/chef/cache/cookbooks/application_java/providers/tomcat.rb:48:in
block (2 levels) in class_from_file' /var/chef/cache/cookbooks/application_java/providers/tomcat.rb:46:in block in
class_from_file'
/var/chef/cache/cookbooks/application/providers/default.rb:110:in
block (3 levels) in before_deploy' /var/chef/cache/cookbooks/application/providers/default.rb:109:in each'
/var/chef/cache/cookbooks/application/providers/default.rb:109:in
`block (2
levels) in before_deploy'

Resource Declaration:

In /var/chef/cache/cookbooks/application/providers/default.rb

107: ruby_block "#{new_resource.name} before_deploy" do
108:block do
109: new_resource.sub_resources.each do |resource|
110: resource.run_action :before_deploy
111: end
112: callback(:before_deploy, new_resource.before_deploy)
113:end
114: end
115: end

Compiled Resource:

Declared in

/var/chef/cache/cookbooks/application/providers/default.rb:107:in
`before_deploy'

ruby_block("jaxrs_tutorial before_deploy") do
action "run"
retries 0
retry_delay 2
block_name "jaxrs_tutorial before_deploy"
cookbook_name "jaxrs_tutorial"
block
#Proc:0x00000003466538@/var/chef/cache/cookbooks/application/providers/default.rb:108
end

Thanks and Regards,
Oliver Naaris