RE: [jruby-dev] Redbridge NameError: uninitialized constant Arel::Relation::Session

2011-05-05 Thread Michael Fair

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  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
> 
> 
  

Re: [jruby-dev] Redbridge NameError: uninitialized constant Arel::Relation::Session

2011-05-04 Thread Yoko Harada
On Wed, May 4, 2011 at 2:27 PM, Nick Sieger  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




Re: [jruby-dev] Redbridge NameError: uninitialized constant Arel::Relation::Session

2011-05-04 Thread Nick Sieger
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.

/Nick

On Wed, May 4, 2011 at 10:25 AM, Michael Fair  wrote:
> Hi I'm using Redbridge to integrate my rails site with the shinidig project
> to allow it to act as an open social container. For the most part the code
> to retrieve data is working with my models but when I try to do anything
> that modifies data I get the following exception (Note the *** bold line in
> the exception indicating the line in the script):
>
> NameError: uninitialized constant Arel::Relation::Session
>   load_missing_constant at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:506
>   const_missing at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:183
>    each at org/jruby/RubyArray.java:1572
>   const_missing at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:181
>     session at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/arel-1.0.1/lib/arel/algebra/relations/relation.rb:10
>  insert at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/arel-1.0.1/lib/arel/algebra/relations/relation.rb:159
>    send at org/jruby/RubyKernel.java:2042
>  insert at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/relation.rb:14
>  create at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/persistence.rb:271
>  create at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/timestamp.rb:47
>  create at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:281
>   _run_create_callbacks at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:428
>  create at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:281
>    create_or_update at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/persistence.rb:247
>    create_or_update at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:277
>     _run_save_callbacks at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:438
>    create_or_update at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:277
>    save at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/persistence.rb:39
>    save at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/validations.rb:43
>    save at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/attribute_methods/dirty.rb:21
>    save at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/transactions.rb:237
>   with_transaction_returning_status at /home/mike/Aptana Studio 3
> Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/transactions.rb:289

[jruby-dev] Redbridge NameError: uninitialized constant Arel::Relation::Session

2011-05-04 Thread Michael Fair

Hi I'm using Redbridge to integrate my rails site with the shinidig project to 
allow it to act as an open social container. For the most part the code to 
retrieve data is working with my models but when I try to do anything that 
modifies data I get the following exception (Note the *** bold line in the 
exception indicating the line in the script):

NameError: uninitialized constant Arel::Relation::Session
  load_missing_constant at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:506
  const_missing at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:183
   each at org/jruby/RubyArray.java:1572
  const_missing at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:181
session at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/arel-1.0.1/lib/arel/algebra/relations/relation.rb:10
 insert at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/arel-1.0.1/lib/arel/algebra/relations/relation.rb:159
   send at org/jruby/RubyKernel.java:2042
 insert at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/relation.rb:14
 create at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/persistence.rb:271
 create at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/timestamp.rb:47
 create at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:281
  _run_create_callbacks at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:428
 create at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:281
   create_or_update at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/persistence.rb:247
   create_or_update at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:277
_run_save_callbacks at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:438
   create_or_update at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:277
   save at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/persistence.rb:39
   save at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/validations.rb:43
   save at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/attribute_methods/dirty.rb:21
   save at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/transactions.rb:237
  with_transaction_returning_status at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/transactions.rb:289
transaction at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:139
transaction at /home/mike/Aptana Studio 3 
Workspace/shindig/java/server/src/main/webapp/WEB-INF/lib/jruby/1.8/gems/activerecord-3.0.0/lib/active_record/transactions.rb:204
  with_transaction_returning_status at /home/mike/Aptana Studio 3