当前位置: 动力学知识库 > 问答 > 编程问答 >

ruby on rails - jRuby error - can't modify frozen array

问题描述:

I keep getting this error in my App, no matter what I try to fix.

"can't modify frozen array"

Any idea what could be possibly wrong here? I am running a jRuby (1.6.2) app on Torquebox (1.0.1) on my local Ubuntu (10.04) machine. Here is a complete stack trace

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: org.jruby.exceptions.RaiseException: (TypeError) can't modify frozen array

org.torquebox.rack.core.servlet.RackFilter.doRack(RackFilter.java:118)

org.torquebox.rack.core.servlet.RackFilter.doFilter(RackFilter.java:103)

org.torquebox.rack.core.servlet.RackFilter.doFilter(RackFilter.java:75)

root cause

org.jruby.exceptions.RaiseException: (TypeError) can't modify frozen array

org.jruby.RubyArray.concat(org/jruby/RubyArray.java:1450)

#<Class:0x1009c9a44>.Plugin(/home/torquebox-1.0.1/jruby/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/plugin.rb:71)

org.jruby.RubyKernel.instance_exec(org/jruby/RubyKernel.java:2045)

rubyjit.run_7761DFB9328DE427D0E75A527B886E70C475D69F.run(/home/torquebox-1.0.1/jruby/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/initializable.rb:25)

#<Class:0x1000dfe45>.run_initializers(/home/torquebox-1.0.1/jruby/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/initializable.rb:50)

org.jruby.RubyArray.each(org/jruby/RubyArray.java:1602)

Rails::Initializable.run_initializers(/home/torquebox-1.0.1/jruby/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/initializable.rb:49)

Rails::Application.initialize!(/home/torquebox-1.0.1/jruby/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:134)

rubyjit.method_added_79E9152BC344C327B5B6A61AD8A4DB7112D305D2.method_added(classpath:/org/torquebox/rails/core/boot.rb:78)

org.jruby.RubyKernel.send(org/jruby/RubyKernel.java:2059)

#<Class:0x101305815>.method_missing(/home/torquebox-1.0.1/jruby/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:77)

#<Class:0x1002cf032>.(root)(vfs:/home/Ruby_Projects/Sample-Torquebox-App/config/environment.rb:5)

org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1038)

rubyjit.require_48BC09453A4C02A82A5E47520814DA9EA3718525.require(/home/torquebox-1.0.1/jruby/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64)

rubyjit.require_3E6CA858403268171F46C45451765CD50640768C.require(/home/torquebox-1.0.1/jruby/lib/ruby/gems/1.8/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239)

rubyjit.load_dependency_04443C3CFAC2D53B173F0FF308908A72BD893CCC.load_dependency(/home/torquebox-1.0.1/jruby/lib/ruby/gems/1.8/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:227)

rubyjit.require_3E6CA858403268171F46C45451765CD50640768C.require(/home/torquebox-1.0.1/jruby/lib/ruby/gems/1.8/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239)

#<Class:0x101f38e01>.(root)(vfs:/home/Ruby_Projects/Sample-Torquebox-App/config/environment.rb:6)

org.jruby.RubyKernel.instance_eval(org/jruby/RubyKernel.java:2028)

Rack::Builder.initialize(/home/torquebox-1.0.1/jruby/lib/ruby/gems/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46)

#<Class:0x1002cf032>.(root)(vfs:/home/Ruby_Projects/Sample-Torquebox-App/config.ru:3)

note The full stack trace of the root cause is available in the JBoss Web/3.0.0-CR1 logs.

JBoss Web/3.0.0-CR1

网友答案:

If you get the error during startup, chances are big you're actually trying to redefine a frozen array in an initializer (could be as simple as redifining ABBR_DAYNAMES). If the application can run under MRI you could try that, since it gives you verbose warnings about this.

If there's nothing in your initializer, then it might be a gem that you included in your application. Try taking out gems one by one and see what the result is.

分享给朋友:
您可能感兴趣的文章:
随机阅读: