Skip to content

Instantly share code, notes, and snippets.

09:46:38,166 ERROR [org.torquebox.core.runtime] (pool-12-thread-1) Error during execution: ENV['RAILS_ROOT']=RACK_ROOT
ENV['RAILS_ENV']=RACK_ENV
require %q(org/torquebox/web/rails/boot)
: org.jruby.exceptions.RaiseException: (LoadError) library `fcntl' could not be loaded: java.lang.NullPointerException
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1033) [jruby.jar:]
at (Anonymous).(root)(/Users/jkutner/.rvm/gems/jruby-1.6.7@global/gems/jruby-openssl-0.7.6.1/lib/1.8/openssl/ssl-internal.rb:18) at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1033) [jruby.jar:]
at (Anonymous).(root)(/Users/jkutner/.rvm/gems/jruby-1.6.7@global/gems/jruby-openssl-0.7.6.1/lib/1.8/openssl/ssl-internal.rb:66) at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:1058) [jruby.jar:]
at (Anonymous).(root)(/Users/jkutner/.rvm/gems/jruby-1.6.7@global/gems/jruby-openssl-0.7.6.1/lib/1.8/openssl.rb:17) at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1033) [jruby.jar:]
at (Anonymous).(root)(/Users/jkutne
$ gem install torquebox-server

Download mod_cluster from here: http://www.jboss.org/mod_cluster/downloads/1-2-0-Final

$ tar xvzf mod_cluster-1.2.0.Final-macosx-x86-ssl.tar.gz
$ ./opt/jboss/httpd/sbin/installhome.sh

Uncomment this line in opt/jboss/httpd/httpd/conf/httpd.conf

=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /Users/jkutner/.rvm/gems/jruby-1.6.7/gems/torquebox-server-2.0.0-java/jboss
JAVA: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java
JAVA_OPTS: -d32 -client -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml -Xss2048k
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /Users/jkutner/.rvm/gems/jruby-1.6.7/gems/torquebox-server-2.0.0-java/jboss
JAVA: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java
JAVA_OPTS: -d32 -client -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml -Xss2048k
$JBOSS_HOME/bin/standalone.sh --server-config=standalone-ha.xml
$JBOSS_HOME/bin/standalone.sh -Djboss.socket.binding.port-offset=100 \
-Djboss.server.data.dir=/tmp/node2 -Djboss.node.name=node2 --server-config=standalone-ha.xml
begin
require 'fcntl'
rescue LoadError
# This traps an error brought on by some combination of TorqueBox and the
# twitter Gem on Mac OS X. The bug is difficult to reproduce consistently
# and is recorded here: http://jira.codehaus.org/browse/JRUBY-5753
# By trapping the error early on like this, it allows the second load of the
# 'fcntl' lib, which happens inside the twitter Gem, to be successful.
end
@jkutner
jkutner / lifecycle_listener_host.rb
Created May 4, 2012 13:33
Zero-Downtime deploys with JRuby
def check_monitors
@contexts.each do |c|
#...
c[:context] = create_takeover(c)
Thread.new { c[:context].start }
end
end
def create_takeover(c)
web_app = c[:app]
@jkutner
jkutner / hash.rb
Created May 9, 2012 21:14
Monkey patch Hash
class Hash
def method_missing(name, args, &block)
self[name]
end
end
require 'java'
java_import '.com.foo.bar.MyClass'
describe 'MyClass.f' do
it 'is on java' do
RUBY_DESCRIPTION.should be_include 'jruby'
end
it 'is a strange string' do
A.f.should == 'sajdfksadfsd'
$ ruby run.rb
.......
Finished in 0.452 seconds
7 examples, 0 failures
10.206000 0.000000 10.206000 ( 10.205000)
......F
Failures: