Your suggestion worked. I forced rails into production mode by adding 
ENV['RAILS_ENV'] ||= 'production' to the initialization script so the script 
becomes:

String script = "$LOAD_PATH << load_path; ENV['RAILS_ENV'] ||= 
'production';ENV['GEM_HOME'] = gem_path;ENV['BUNDLE_GEMFILE'] = gemfile\n" +
"require 'config/environment'\n" +
"ActionController::Routing::Routes.finalize!";
container.runScriptlet(script);

The initialization code does not raise any exceptions so we're good to go. 
Looks like you were right about the loading bug.

- Mike
> Date: Wed, 4 May 2011 17:11:06 -0400
> From: [email protected]
> To: [email protected]
> Subject: Re: [jruby-dev] Redbridge NameError: uninitialized constant 
> Arel::Relation::Session
> 
> On Wed, May 4, 2011 at 2:27 PM, Nick Sieger <[email protected]> wrote:
> > This looks like a subtle loading/dependencies bug with Arel 1.0,
> > ActiveSupport::Dependencies and the way that you're initializing
> > Rails. I'm not sure exactly what needs to be corrected, but I'd
> > suggest making sure that AS::Dependencies are turned off (i.e, run
> > Rails in production mode with eager loading). That should disable the
> > AS constant lookup behavior that's causing you this problem.
> 
> This might solve your problem. You are using Concurrent type, so Ruby
> runtime is a singleton. If your code below:
> 
>         String script =
>                 "$LOAD_PATH << load_path; ENV['GEM_HOME'] = gem_path;
> ENV['BUNDLE_GEMFILE'] = gemfile\n" +
>                 "require 'config/environment'\n" +
>                 "ActionController::Routing::Routes.finalize!";
>         container.runScriptlet(script);
> 
> didn't raise any error/exception, ActionController was successfully
> loaded on Runtime and available to use from any Servlet in the same
> classloader.
> 
> If Nick's advice doesn't work, would try that without setting a custom
> classloader to ScriptingContainer?
> 
> -Yoko
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 
> 
                                          

Reply via email to