Issue using JRuby-Rack 0.9.1 with Tomcat 6

Hello,

I responded over a week ago to the JRuby-Rack 0.9.10 announcement with
this
error I’m seeing getting but never got any response. I still haven’t
had
any luck figuring this out, so I wanted to ask again.

I’m trying to get my JRuby on Rails app running on Tomcat 6 using JRuby
1.1.3, Warbler 0.9.10, JRuby-Rack 0.9.1 and Rails 2.0.2. The war seems
to
autodeploy fine, but when I try the app, I get the exception below. The
path to my deployed app is getting mangled, apparently by JRuby-Rack.
The
relevant stack trace is below. Somehow the path “…/.netbeans/6.1/…”
becomes “…/.netbeans.1/…” (notice the missing /6). And of course it
can’t find my rails environment file since that directory doesn’t exist.
Has anyone seen this before? Any idea how to deal with it?

Thanks,
Myron

The stack trace:
org.jruby.rack.RackInitializationException: No such file to load –
C:\Users\Myron.netbeans.1\apache-tomcat-6.0.16_base\webapps\FractalComposerDotCom\WEB-INF/config/environment.rb
from
file:/C:/Users/Myron/.netbeans/6.1/apache-tomcat-6.0.16_base/webapps/FractalComposerDotCom/WEB-INF/lib/jruby-rack-0.9.1.jar!/jruby/rack/rails.rb:29:in
load_environment' from file:/C:/Users/Myron/.netbeans/6.1/apache-tomcat-6.0.16_base/webapps/FractalComposerDotCom/WEB-INF/lib/jruby-rack-0.9.1.jar!/jruby/rack/rails.rb:148:innew’
from :3
from
file:/C:/Users/Myron/.netbeans/6.1/apache-tomcat-6.0.16_base/webapps/FractalComposerDotCom/WEB-INF/lib/jruby-rack-0.9.1.jar!/rack/builder.rb:22:in
instance_eval' from file:/C:/Users/Myron/.netbeans/6.1/apache-tomcat-6.0.16_base/webapps/FractalComposerDotCom/WEB-INF/lib/jruby-rack-0.9.1.jar!/rack/builder.rb:22:ininitialize’
from :3:in `new’
from :3

Hi Myron,

I haven’t seen your error before, but I’ve seen other errors related
to Tomcat with JRuby-Rack. It’s on my list to do some compatibility
testing with Tomcat soon.

Is there any part of your application or server configuration that
uses backslashes, or is that just coming out of JRuby or Java? The
code in JRuby-Rack that sets RAILS_ROOT is here:

http://github.com/nicksieger/jruby-rack/tree/master/src/main/ruby/jruby/rack/servlet_helper.rb#L131-137

Can you see anything in that code that would cause you problems?
Perhaps Tomcat doesn’t like my usage of ServletContext.getRealPath?

Cheers,
/Nick

On Tue, Aug 5, 2008 at 6:18 PM, Myron M. [email protected]
wrote:

relevant stack trace is below. Somehow the path “…/.netbeans/6.1/…”
from
file:/C:/Users/Myron/.netbeans/6.1/apache-tomcat-6.0.16_base/webapps/FractalComposerDotCom/WEB-INF/lib/jruby-rack-0.9.1.jar!/rack/builder.rb:22:in
initialize' from <script>:3:in new’
from :3


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Is there any part of your application or server configuration that
uses backslashes, or is that just coming out of JRuby or Java?

It’s coming out of JRuby and Java. I searched my code base, and every
use
of a backslash character is as an escape character in a string or
regular
expression.

The code in JRuby-Rack that sets RAILS_ROOT is here:

Do you think RAILS_ROOT is being set to the wrong value? I’d like to
test
that, but I’m not sure how, since it never finds the config file and
starts
up.

Can you see anything in that code that would cause you problems?
Perhaps Tomcat doesn’t like my usage of ServletContext.getRealPath?

Everything there looks fine to me, but I’m totally unfamiliar with the
ServletContext interface and Tomcat (or any other java server)…so I
don’t
think I’d recognize a non-obvious problem if there was one.

Given that you haven’t seen this error before, it seems like there must
be
something with my code or configuration that isn’t working properly. Do
you
have any suggestions for how to go about trouble shooting this?

Thanks,
Myron

On Wed, Aug 6, 2008 at 7:25 PM, Myron M. [email protected]
wrote:

that, but I’m not sure how, since it never finds the config file and starts
something with my code or configuration that isn’t working properly. Do you
have any suggestions for how to go about trouble shooting this?

It’s possible, but I’m more inclined to blame JRuby-Rack and/or
Tomcat, given that you haven’t mentioned anything out of the ordinary
that you’re doing with warbler and/or jruby-rack.

Sorry I don’t have any immediate suggestions! If you have a sample app
that exhibits the behavior you see that I could try, that would be a
great help.

Cheers,
/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Installing Tomcat from scratch fixed the problem. Originally I was
using
the tomcat installation that comes with Netbeans 6.1. I don’t know
whether
I screwed it up or Netbeans misconfigured it…but regardless, it works
now.

< Sorry I don’t have any immediate suggestions! If you have a sample app
< that exhibits the behavior you see that I could try, that would be a
< great help.

I tried creating a new bare-bones rails app (no models, one controller,
with
one action and one view with some simple ERB). When I deployed to
Tomcat, I
was able to access the “Welcome Aboard–you’re riding Ruby on Rails”
default
index.html file (since its served statically), but as soon as I went to
the
URL for the controller, I got the exact same error. So that definitely
means that it’s not something specific to my application.

I haven’t fully decided whether I’ll be using Tomcat or Glassfish to
serve
my app, so I’ve been working on getting it to work in Glassfish as well.
I’ve gotten that to work fine…so that seems to imply that there is
something wrong with the way Tomcat is configured on my machine.

I’m going to try downloading and installing Tomcat from scratch and see
if I
have any luck.

Thanks,
Myron