Ok, we’re totally noobs
We fixed the tomcat problem by adding this to production.rb:
config.threadsafe!
Fixed the problem malloc problem with this in the .bash_profile
export JRUBY_OPTS=-“-1.9 --server -J-Xmx1024m”
Hope that helps some other noobs
Kevin English
From: Riot IT
<[email protected]mailto:[email protected]>
Reply-To: “[email protected]mailto:[email protected]”
<[email protected]mailto:[email protected]>
Date: Fri, 16 Sep 2011 22:15:19 -0700
To: “[email protected]mailto:[email protected]”
<[email protected]mailto:[email protected]>
Subject: Re: [jruby-user] jruby 1.6.4 and rails 3.1
Also, when we create a war using warble and deploy to tomcat, we get the
following:
org.jruby.rack.RackInitializationException: invalid runtime
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
require' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in
load_dependency’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
require' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/yajl-ruby-0.8.3/lib/yajl.rb:2:in
(root)’
from org/jruby/RubyKernel.java:1047:in require' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
require’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in
load_dependency' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
require’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/yajl-ruby-0.8.3/lib/yajl.rb:2:in
(root)' from org/jruby/RubyKernel.java:1047:in
require’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
require' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in
load_dependency’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
require' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/yajl-ruby-0.8.3/lib/yajl/json_gem.rb:7:in
(root)’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/ohm-contrib-0.1.1/lib/ohm/contrib/typecast.rb:3:in
Comment' from /usr/local/apache-tomcat-6.0.32/webapps/comments/WEB-INF/app/models/comment.rb:1:in
(root)’
from org/jruby/RubyKernel.java:1047:in require' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
require’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in
load_dependency' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
require’
from
/usr/local/apache-tomcat-6.0.32/webapps/comments/WEB-INF/app/models/comment.rb:348:in
require_or_load' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:489:in
load_missing_constant’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:181:in
const_missing' from org/jruby/RubyArray.java:1603:in
each’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:179:in
const_missing' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:124:in
constantize’
from org/jruby/RubyArray.java:1603:in each' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:123:in
constantize’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/core_ext/string/inflections.rb:43:in
constantize' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/actionpack-3.1.0/lib/action_controller/metal/params_wrapper.rb:148:in
_default_wrap_model’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/actionpack-3.1.0/lib/action_controller/metal/params_wrapper.rb:167:in
_set_wrapper_defaults' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/actionpack-3.1.0/lib/action_controller/metal/params_wrapper.rb:128:in
inherited’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/actionpack-3.1.0/lib/abstract_controller/railties/routes_helpers.rb:7:in
inherited' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/actionpack-3.1.0/lib/action_controller/railties/paths.rb:7:in
inherited’
from
/usr/local/apache-tomcat-6.0.32/webapps/comments/WEB-INF/app/controllers/comments_controller.rb:1:in
(root)' from org/jruby/RubyKernel.java:1047:in
require’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
require' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in
load_dependency’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
require' from /usr/local/apache-tomcat-6.0.32/webapps/comments/WEB-INF/app/controllers/comments_controller.rb:348:in
require_or_load’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:302:in
depend_on' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:214:in
require_dependency’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/railties-3.1.0/lib/rails/engine.rb:416:in
eager_load!' from org/jruby/RubyArray.java:1603:in
each’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/railties-3.1.0/lib/rails/engine.rb:415:in
eager_load!' from org/jruby/RubyArray.java:1603:in
each’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/railties-3.1.0/lib/rails/engine.rb:413:in
eager_load!' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/railties-3.1.0/lib/rails/application/finisher.rb:51:in
Finisher’
from org/jruby/RubyBasicObject.java:1744:in instance_exec' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/railties-3.1.0/lib/rails/initializable.rb:25:in
run’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/railties-3.1.0/lib/rails/initializable.rb:50:in
run_initializers' from org/jruby/RubyArray.java:1603:in
each’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/railties-3.1.0/lib/rails/initializable.rb:49:in
run_initializers' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/railties-3.1.0/lib/rails/application.rb:92:in
initialize!’
from org/jruby/RubyBasicObject.java:1685:in __send__' from org/jruby/RubyKernel.java:2113:in
send’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in
method_missing' from /usr/local/tomcat/webapps/comments/WEB-INF/config/environment.rb:5:in
(root)’
from org/jruby/RubyKernel.java:1047:in require' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
require’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in
load_dependency' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in
new_constants_in’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:639:in
new_constants_in' from /usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in
load_dependency’
from
/usr/local/tomcat/webapps/comments/WEB-INF/gems/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
require' from /usr/local/tomcat/webapps/comments/WEB-INF/config/environment.rb:169:in
load_environment’
from
file:/usr/local/apache-tomcat-6.0.32/webapps/comments/WEB-INF/lib/jruby-rack-1.0.10.jar!/jruby/rack/rails.rb:173:in
to_app' from file:/usr/local/apache-tomcat-6.0.32/webapps/comments/WEB-INF/lib/jruby-rack-1.0.10.jar!/jruby/rack/rails.rb:193:in
new’
from <web.xml>:1:in (root)' from org/jruby/RubyBasicObject.java:1717:in
instance_eval’
from
file:/usr/local/apache-tomcat-6.0.32/webapps/comments/WEB-INF/lib/jruby-rack-1.0.10.jar!/vendor/rack-1.3.2/rack/builder.rb:51:in
initialize' from <web.xml>:1:in
(root)’
at
org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:204)
at
org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:54)
at
org.jruby.rack.PoolingRackApplicationFactory.getApplication(PoolingRackApplicationFactory.java:95)
at
org.jruby.rack.DefaultRackDispatcher.process(DefaultRackDispatcher.java:28)
at org.jruby.rack.RackFilter.doFilter(RackFilter.java:58)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:680)
Caused by: org.jruby.exceptions.RaiseException: (RuntimeError) invalid
runtime
From: Riot IT
<[email protected]mailto:[email protected]>
Reply-To: “[email protected]mailto:[email protected]”
<[email protected]mailto:[email protected]>
Date: Fri, 16 Sep 2011 19:28:25 -0700
To: “[email protected]mailto:[email protected]”
<[email protected]mailto:[email protected]>
Subject: [jruby-user] jruby 1.6.4 and rails 3.1
Hi,
We are having problems with JSON using JRuby 1.6.4 and Rails 3.1
I copied the template here (using rails 3.1)
When I do ‘rake db:migrate’ or ‘rake db:test:prepare’, I get:
no such file to load – json/pure
To resolve this, I put
gem “json_pure”, “~> 1.6.0”
However, after doing a ‘bundle install’, when I have a simple rspec test
like this:
it "should send back a error response" do
put :update, format: 'json', id: @comment.id, comment:
{message: ‘’}
json = ActiveSupport::JSON.decode(response.body,
symbolize_keys: true)
json[:status].should == ‘error’
json[:status].should_not == ‘success’
end
jruby -S bundle exec rspec spec/controllers/comments_controller_spec.rb
I get:
…….java(25268,0x114c0d000) malloc: *** error for object
0x10011e040: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
rake aborted!
ruby -S bundle exec rspec ./spec/controllers/comments_controller_spec.rb
./spec/helpers/comments_helper_spec.rb ./spec/models/comment_spec.rb
./spec/models/discussion_spec.rb ./spec/support/redis_helpers_spec.rb
failed
/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rspec-core-2.6.4/lib/rspec/core/rake_task.rbmailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rspec-core-2.6.4/lib/rspec/core/rake_task.rb:139:in
initialize' /Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/file_utils_ext.rb<mailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/file_utils_ext.rb>:57:in
verbose’
org/jruby/RubyBasicObject.java:1691:in __send__' org/jruby/RubyKernel.java:2117:in
send’
/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rspec-core-2.6.4/lib/rspec/core/rake_task.rbmailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rspec-core-2.6.4/lib/rspec/core/rake_task.rb:131:in
initialize' org/jruby/RubyProc.java:262:in
call’
/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/task.rbmailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/task.rb:205:in
execute' org/jruby/RubyArray.java:1603:in
each’
/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/task.rbmailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/task.rb:200:in
execute' /Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/task.rb<mailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/task.rb>:158:in
invoke_with_call_chain’
/Users/kevin.english/.rvm/rubies/jruby-1.6.4/lib/ruby/1.9/monitor.rb:201:in
mon_synchronize' /Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/task.rb<mailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/task.rb>:151:in
invoke_with_call_chain’
/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/task.rbmailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/task.rb:144:in
invoke' /Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rb<mailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rb>:112:in
invoke_task’
/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rbmailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rb:90:in
top_level' org/jruby/RubyArray.java:1603:in
each’
/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rbmailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rb:90:in
top_level' /Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rb<mailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rb>:129:in
standard_exception_handling’
/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rbmailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rb:84:in
top_level' /Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rb<mailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rb>:62:in
run’
/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rbmailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rb:129:in
standard_exception_handling' /Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rb<mailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/lib/rake/application.rb>:59:in
run’
/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/bin/rakemailto:/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/gems/rake-0.9.2/bin/rake:32:in
(root)' org/jruby/RubyKernel.java:1073:in
load’
/Users/kevin.english/.rvm/gems/jruby-1.6.4@comments/bin/rake:19:in
`(root)’
Kevin