Having Trouble Deploying JRuby on Rails app to Tomcat 6

I’m developing a JRuby on Rails app using netbeans 6.1. I’m trying to
deploy
to Tomcat 6. I’ve installed warbler as a plugin, and it’s generated my
WAR
file. I copied it to $TOMCAT_HOME/webapps and I can access it in my
browser
at
http://localhost:8084/$YOUR_APP_NAMEhttp://localhost:8080/$YOUR_APP_NAMEjust
fine. However, none of my images show on the page, and after doing
some research on Google, it’s clear that my app needs to run as the root
webapp in Tomcat because of some of the logic used by the rails asset
tags.

This is my first time using Tomcat, so I’m not quite sure how to
configure
Tomcat to make my app run as the root. Googling the topic gave me
several
things to try (e.g. renaming my war as ROOT.war and removing the
existing
ROOT webapp; creating a ROOT.xml file in
$CATALINA_HOME/conf/[enginename]/[hostname]/ with a docBase element
pointing
to my war file), but none of these are working. In each case, I get a
java.lang.OutOfMemoryError. Here’s the stack trace:

Jun 10, 2008 2:25:30 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Exception caught
org.jruby.rack.RackInitializationException: IO error –
builtin/java/exceptions
from
file:/C:/Users/Myron/.netbeans/6.1/apache-tomcat-6.0.16_base/webapps/ROOT/WEB-INF/lib/jruby-complete-1.1.2.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/builtin/javasupport.rb:47:in
`file:/C:/Users/Myron/.netbeans/6.1/apache-tomcat-6.0.16_base/webapps/ROOT/WEB-INF/lib/jruby-complete-1.1.2.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/builtin/javasupport.rb’
from
file:/C:/Users/Myron/.netbeans/6.1/apache-tomcat-6.0.16_base/webapps/ROOT/WEB-INF/lib/jruby-complete-1.1.2.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/builtin/javasupport.rb:1

at

org.jruby.rack.DefaultRackApplicationFactory.newRuntime(DefaultRackApplicationFactory.java:85)
at
org.jruby.rack.DefaultRackApplicationFactory.createApplication(DefaultRackApplicationFactory.java:144)
at
org.jruby.rack.DefaultRackApplicationFactory.newApplication(DefaultRackApplicationFactory.java:44)
at
org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:52)
at
org.jruby.rack.PoolingRackApplicationFactory.getApplication(PoolingRackApplicationFactory.java:92)
at
org.jruby.rack.DefaultRackDispatcher.process(DefaultRackDispatcher.java:31)
at org.jruby.rack.RackFilter.doFilter(RackFilter.java:51)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:196)
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:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
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:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.jruby.exceptions.RaiseException: IO error –
builtin/java/exceptions
Caused by: java.lang.OutOfMemoryError: Java heap space

Not sure if this helps, but here’s my environment:
Windows Vista
MySQL 5
Netbeans 6.1
Rails 2.1
JRuby 1.1.2
Tomcat 6.0.16

Anyone know how to get this to work?

Thanks,
Myron

Hi,

Whenever possible don’t use relative paths in your rails app. Use
instead
RAILS_ROOT + ‘/’ + filename. If you can’t avoid using relative paths,
you
don’t have to make you rails app a ROOT app; instead you can put the
contents of the folder public into the folder webapps of your tomcat.
That
problem happened to me when using Jmaki and forced me to take the
“resources” folder that was in the my rails app’s public folder and move
it
to the “webapps” folder of tomcat (which is basicaly the root folder for
tomcat) without me having to make my app a root app.

I guess for you, you could just move the images folder to the webapps
folder.

Best regards,
Juan

On Tue, June 10, 2008 2:30 am, Myron M. wrote:

org.jruby.rack.RackInitializationException: IO error –

at
ionFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilte
at
)
Windows Vista
Thanks,
Myron

Best regards,

Juan P. Tarquino
Westwood Christian School


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Thanks for the tip. I may try this next, but regardless of whether or
not
there’s a way to get my rails app working without it running as the root
app, I’d still like to deploy it as the root app. Rails has some
internal
logic that assumes it is running as a root app, so I feel like I’ll
probably
run into more things down the road that don’t work right if it’s not the
root app.

Thanks,
Myron

On Tue, Jun 10, 2008 at 11:03 PM, Juan P. Tarquino <

I’m able to run my rails applications inside different context paths
than
root, with jruby-rack (which warbler uses) and jetty-rails. Curiously,
it
required no extra effort!
Would you mind testing your app in jetty-rails? Perhaps it fixes
something
without even realizing it.

On Tue, Jun 10, 2008 at 11:20 AM, Myron M.
[email protected]
wrote:

“resources” folder that was in the my rails app’s public folder and move
On Tue, June 10, 2008 2:30 am, Myron M. wrote:

tags.
get a java.lang.OutOfMemoryError. Here’s the stack trace:

org.jruby.rack.DefaultRackApplicationFactory.newApplication(DefaultRackAp

at
rChain.java:206)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:

at
Rails 2.1

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Fabio K.

Caelum - Ensino e Soluções em Computação

Thanks for the suggestion! I assume jetty-rails requires Jetty? I’d
prefer
not to use a different java server. I’m going to be using a hosting
company
for my web app, and virtually all the hosting companies that support
java
support Tomcat. I haven’t seen many that support Jetty.

You are right. It comes with a bundled jetty.
I was asking you to test, just to see if jetty-rails is doing something
to
support context paths other than root. In that case, I could tell to you
what it is being done and you might reproduce it in your jruby-rack +
tomcat
deployment.

On Wed, Jun 11, 2008 at 6:40 AM, Myron M. [email protected]
wrote:

Would you mind testing your app in jetty-rails? Perhaps it fixes something

run into more things down the road that don’t work right if it’s not the

to the “webapps” folder of tomcat (which is basicaly the root folder for

deploy to Tomcat 6. I’ve installed warbler as a plugin, and it’s

get a java.lang.OutOfMemoryError. Here’s the stack trace:
ruby/1.8/builtin/javasupport.rb:47:in

at
rChain.java:206)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilte

at
ttp11Protocol.java:583)
MySQL 5
Myron


Fabio K.
http://www.fabiokung.com

Caelum - Ensino e Soluções em Computação
http://www.caelum.com.br


Fabio K.

Caelum - Ensino e Soluções em Computação