Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: David Calavera
Votes: 1
Watchers: 1

If you were logged in you would be able to see more operations.

undefined method `new' for "Rack::Lock":String with Warbler 1.0.0 + JRuby 1.3.0 + Rails 2.3.2

Created: 25/Jul/09 10:52 PM   Updated: 24/Aug/09 11:09 PM   Resolved: 24/Aug/09 11:09 PM
Component/s: None
Affects Version/s: 0.9.4
Fix Version/s: 0.9.5

Time Tracking:
Not Specified


 Description  « Hide

This bug was already open in jruby jira but it's a jruby-rack issue:

Jruby-rack raises this error with glassfish and tomcat at least:

Caused by: org.jruby.rack.RackInitializationException: undefined method `new' for "Rack::Lock":String
from /Users/arungupta/tools/glassfish/v2.1/glassfish/nodeagents/cloud-nodeagent/cabernet/app
e_stack.rb:116:in `inject'
from /Users/arungupta/tools/glassfish/v2.1/glassfish/nodeagents/cloud-nodeagent/cabernet/app
e_stack.rb:116:in `build'
from /Users/arungupta/tools/glassfish/v2.1/glassfish/nodeagents/cloud-nodeagent/cabernet/app
r.rb:82:in `initialize'
from /Users/arungupta/tools/glassfish/v2.1/glassfish/nodeagents/cloud-nodeagent/cabernet/app
r.rb:52:in `run_prepare_callbacks'

David Calavera added a comment - 25/Jul/09 10:56 PM

Well after dive into jruby-rack code and jar file finally I found the problem.

jruby-rack-0.9.4.jar doesn't contain rack/lock.rb!!! that's it.

Rack::Lock is just used with some database adapters that's the reason why it just crashes sometimes.

Nick Sieger added a comment - 26/Jul/09 01:24 PM

This is resolved with 0.9.5, but...

If jruby-rack didn't bundle its own version of Rack this wouldn't be an issue and people could choose whatever version of Rack was suitable for their environment.

David Calavera added a comment - 28/Jul/09 07:05 AM

Agree, actually as jruby-rack user I didn't mind to have that dependency, I mean, warble already vendorize rack gem and it could be a requirement for jruby-rack custom usages.

arungupta added a comment - 30/Jul/09 04:52 PM

Is there a known workaround to this problem ?

arungupta added a comment - 30/Jul/09 05:28 PM

Gary Weaver suggested the following work around:

– cut here –
Having trouble getting into Kenai at the moment, but the workaround to your issue below should be to use the latest jruby-rack. How to override the one packaged in warbler is:

  1. Additional Java .jar files to include. Note that if .jar files are placed
  2. in lib (and not otherwise excluded) then they need not be mentioned here.
  3. JRuby and JRuby-Rack are pre-loaded in this list. Be sure to include your
  4. own versions if you directly set the value
  5. config.java_libs += FileList["lib/java/*.jar"]
    config.java_libs.delete_if {|f| f =~ /jruby-rack/ || f =~ /jruby-complete/ }
    config.java_libs += FileList["lib/jruby-complete*.jar"]
    config.java_libs += FileList["lib/jruby-rack*.jar"]

then put the jruby-rack and jruby-complete jars you want to use in the lib/ dir.

The jruby-rack snapshot containing this fix is:

You'll need to find the jruby jar you want to use and put it in the lib dir or remove that part from above.

My related blog entries:

If you could post this into the Kenai ticket if it works for you, that would be great.
– cut here –

gswduke added a comment - 30/Jul/09 06:39 PM

(just got my Kenai acct. stuff straightened out)

A few more notes about the workaround:

  • Do warble war:clean first to make sure it removes previous versions of jruby-rack, or it won't fix it (I did that. ugh!).
  • Nick was the one who described how to do this for me and told me that the new jar fixed it (and he noted that in the ticket also).


Nick Sieger added a comment - 24/Aug/09 11:09 PM

As of 7a14ac4, JRuby-Rack allows a newer rack to be loaded and doesn't force its vendored copy on you.