Forum: JRuby Problems deploying compiled rails app to Java servers

Posted by Jon Cairns (jonathan_c)
on 2013-01-31 12:41
(Received via mailing list)
Hi all,

I'm trying to deploy a rails app using jruby, by bundling it as a war 
file
and using a Java server (tried Tomcat and Jetty). The twist is that I 
want
to compile everything in the /app/ and /lib/ directory to bytecode
(".class") files, instead of using the rb files. You might ask why, and
reasonably so: it's to comply with an awkward request from a client.

I read through an old message on this very subject, which is archived 
here:
http://ruby.11.n6.nabble.com/Compiling-Rails-app-t...

My problem is this. After compiling the ruby files to .class files and
removing, I test that the app actually works by starting up webrick 
(jruby
-S rails server) - no problems there, the app works fine.

I then bundle it up as a war file using warble, and drop it into the 
webapp
directory on Jetty or Tomcat. I then get the same error on both of these
servers:

*Jetty*
org.jruby.exceptions.RaiseException: (LoadError) load error:
/var/cache/jetty/data/Jetty__8080_root.war___.an5myb/webapp/WEB-INF/app/models/user
-- java.lang.NoSuchMethodError:
org.jruby.javasupport.util.RuntimeHelpers.preLoad(Lorg/jruby/runtime/ThreadContext;Ljava/lang/String;Z)V
  at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1027)
  at
ActiveSupport::Dependencies::Loadable.require(/var/cache/jetty/data/Jetty__8080_root.war___.an5myb/webapp/WEB-INF/gems/bundler/gems/rails-4894465c3527/activesupport/lib/active_support/dependencies.rb:251)
        ... *snip*

*Tomcat*
org.jruby.exceptions.RaiseException: (LoadError) load error:
/var/lib/tomcat7/webapps/ROOT/WEB-INF/app/models/user --
java.lang.NoSuchMethodError:
org.jruby.javasupport.util.RuntimeHelpers.preLoad(Lorg/jruby/runtime/ThreadContext;Ljava/lang/String;Z)V
  at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1027)
  at
ActiveSupport::Dependencies::Loadable.require(/var/lib/tomcat7/webapps/ROOT/WEB-INF/gems/bundler/gems/rails-4894465c3527/activesupport/lib/active_support/dependencies.rb:251)
        ... *snip*

I'm intrigued by the fact that it's a "NoSuchMethodError", but I have no
idea how jruby works (I only started using it a couple of days ago, and
still trying to get to grips with it). I should also mention that this 
only
occurs when compiling the app directory to bytecode, i.e. packaging the 
ruby
files as a war and running on Tomcat/Jetty works fine.

Has anyone got any idea what my problem could be? Any help would be very
appreciated.

Thanks,
Jon



--
View this message in context: 
http://ruby.11.n6.nabble.com/Problems-deploying-co...
Sent from the JRuby - User mailing list archive at Nabble.com.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.