Error loading cookbook sample on Rack

Hi,

I am trying to dpeloy a WAR file created using warbler 0.9.9 (with Rack)
and
deploy it on GlassFish. The application comes up fine but in the server
log
error message is logged saying it can not find certain files:

Processing CategoriesController#index (for 127.0.0.1 at 2008-05-29
13:39:38)
[GET]
Session ID: 980b1193c95a111af30b05c0d22a55af
Parameters: {“controller”=>“categories”, “action”=>“index”}
Rendering template within layouts/application
Rendering categories/index
Completed in 0.02200 (45 reqs/sec) | Rendering: 0.01700 (77%) | DB:
0.00000
(0%) | 200 OK [http://localhost/cookbook/categories]
|#]

[#|2008-05-29T13:39:38.811-0800|INFO|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=16;_ThreadName=httpSSLWorkerThread-8080-1;|PWC1412:
WebModule[/cookbook] ServletContext.log():

Processing ApplicationController#index (for 127.0.0.1 at 2008-05-29
13:39:38) [GET]
Session ID: 4a550b446fdb0bd2a976d92d67ccefca
Parameters: {}

ActionController::RoutingError (No route matches
“/stylesheets/application.css” with {:method=>:get}):
/gems/gems/actionpack-2.0.2/lib/action_controller/routing.rb:1441:in
recognize_path' /gems/gems/actionpack-2.0.2/lib/action_controller/routing.rb:1424:in recognize’
/gems/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:170:in
handle_request' /gems/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in dispatch’
/gems/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in
dispatch_cgi' /gems/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in dispatch’

/tools/glassfish/domains/domain1/generated/jsp/j2ee-modules/cookbook/loader/rack/adapter/rails.rb:37:in
`serve_rails’

/tools/glassfish/domains/domain1/generated/jsp/j2ee-modules/cookbook/loader/rack/adapter/rails.rb:44:in
`call’

/tools/glassfish/domains/domain1/generated/jsp/j2ee-modules/cookbook/loader/jruby/rack/rails.rb:129:in
`call’

/tools/glassfish/domains/domain1/generated/jsp/j2ee-modules/cookbook/loader/rack/handler/servlet.rb:22:in
`call’

/tools/glassfish/domains/domain1/generated/jsp/j2ee-modules/cookbook/loader/rack/builder.rb:1

Rendering
/tools/glassfish/domains/domain1/applications/j2ee-modules/cookbook/WEB-INF/gems/gems/actionpack-2.0.2/lib/action_controller/templates/rescues/layout.erb
(not_found)

Inside the war file there is layout.erb as part of actionpack gem. Any
idea
whats going on here?

-vivek.

On May 29, 2008, at 4:41 PM, Vivek P. wrote:

[#|2008-05-29T13:39:38.811-0800|INFO|sun-appserver9.1|
javax.enterprise.system.container.web|
_ThreadID=16;_ThreadName=httpSSLWorkerThread-8080-1;|PWC1412:
WebModule[/cookbook] ServletContext.log():

It looks like your app is mounted at the “/cookbook” context root,
but…

ActionController::RoutingError (No route matches “/stylesheets/
application.css” with {:method=>:get}):

…your stylesheet link is to “/stylesheets/application.css”. This is
a common problem with running Rails and Merb in a servlet container.
Out of the box, both Rails and Merb expect that all urls are relative
to the root “/” path, but servlet-based apps usually expect to have a
context root prefix, like “/cookbook”.
I’m not too familiar with Rails anymore, so I can’t tell you exactly
how to fix it, but there should be a setting that you can change to
make Rails generate urls relative to your context root. It used to be
a constant called RAILS_RELATIVE_URL_ROOT (or something like that),
but I think it has a prettier name now.

:dudley


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Thanks!

The change that needs to happen is in config/environments/production.rb:

config.action_controller.asset_host = “/cookbook”

adding the above line takes care of it.

Although warbler should take care of it as for most of the servlet
containers, the war file name goes as the root context of the web
application. Although it brings the question of what if someone deploys
the
war file and tell the container to deploy it at context root!

Still I think there should be an easy way to take care of it otherwise
anyone using warbler has to make sure modifying the production.rb.

-vivek.