Cache Sweeper Problem

Hi!

My name is Ricardo Gonzalez Echavarria. I work at the University of
Chihuahua in Mexico as a Web Applications Senior Developer.

We are currently developing an application using JRuby and Rails and I
have
come across a problem when deploying the application using Warbler.

When running the executable war file I get this exception:

Application Error
org.jruby.rack.RackInitializationException: undefined method
`cache_sweeper’
for AreasController:Class

This exception only occurs when running the executable war or when
deploying
the war file in a servlet container (Tomcat 6). When running the rails
server command everything works as expected.

I hace a class named AreaSweeper which observes the ActiveRecord class
Area.

My Environment:

JRuby 1.5.5
Rails 3.0.3
Warbler 1.2.1

Thank you in advance for your help.

Ricardo Gonzalez
http://twitter.com/r_icarus

On Nov 16, 2010, at 20:46 , Ricardo Gonzalez wrote:

org.jruby.rack.RackInitializationException: undefined method `cache_sweeper’ for
AreasController:Class

This exception only occurs when running the executable war or when deploying the
war file in a servlet container (Tomcat 6). When running the rails server command
everything works as expected.

What happens when you run “rails server -e production”? This more
closely simulates what runs in the war file which also runs in
production mode.

/Nick

On Tue, Nov 16, 2010 at 8:13 PM, Nick S. [email protected]
wrote:

What happens when you run “rails server -e production”? This more closely
simulates what runs in the war file which also runs in production mode.

/Nick

“rails server -e production” works ok although all media links (js, css,
images) are broken. But that seems to be something else…

On Tue, Nov 16, 2010 at 8:32 PM, Ricardo Gonzalez
[email protected]wrote:

Chihuahua in Mexico as a Web Applications Senior Developer.
This exception only occurs when running the executable war or when
images) are broken. But that seems to be something else…

My bad. I had config.serve_static_assets = false in my production.rb

Now the app is working ok in production. It still broken in the war 

file
.

On Wed, Nov 17, 2010 at 10:29 AM, Nick S. [email protected]
wrote:

`cache_sweeper’ for AreasController:Class

/Nick

My Sweepers are in the app/sweepers directory but adding it to the
autoload path didn’t help.
Requiring the ‘action_controller/caching/sweeping’ file in
environment.rb
and application.rb didn’t help either.

However, I just realized that when you set config.cache_clases = false
in
production.rb everything works ok. But I’m a little concerned if that
is going to be a performance hit when I deploy this war to a
production server. What do you think?
/Ricardo

On Tue, Nov 16, 2010 at 9:32 PM, Ricardo Gonzalez
[email protected] wrote:

deploying the war file in a servlet container (Tomcat 6). When running the
rails server command everything works as expected.

What happens when you run “rails server -e production”? This more closely
simulates what runs in the war file which also runs in production mode.
/Nick

“rails server -e production” works ok although all media links (js, css,
images) are broken. But that seems to be something else…

By chance are your cache sweepers in a custom directory? If so, did
you add app/sweepers to the load path in environment.rb? It seems like
there is an autoload problem here somewhere where the sweeper support
is not loaded ahead of time inside the war file. Maybe you can play
around with explicitly requiring ‘action_controller/caching/sweeping’,
or figure out why it isn’t getting loaded.

/Nick

On Wed, Nov 17, 2010 at 12:55 PM, Ricardo Gonzalez
[email protected] wrote:

closely
around with explicitly requiring ‘action_controller/caching/sweeping’,
production.rb everything works ok. But I’m a little concerned if that
is going to be a performance hit when I deploy this war to a
production server. What do you think?

Yes, you definitely don’t want to run with cache_classes = false in
production. Maybe you could try setting config.dependency_loading =
false in production. There seems to be some eager loading issue at
play. Maybe you need to adjust config.eager_load_paths?

/Nick