Problems deploying compiled rails app to Java servers

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-to-class-files-td3462252.html

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-compiled-rails-app-to-Java-servers-tp4987152.html
Sent from the JRuby - User mailing list archive at Nabble.com.