Executable war file

Hello,

We are trying to make a war file with Jruby which will be executable
in non-exploded form with ‘java -jar execwar.war’.

There is a problem with jruby-rack being able to load some of the
rails files from the classpath. Here’s the error:

org.jruby.rack.RackInitializationException: No such file to load –
/Users/pivotal/workspace/execwar/WEB-INF/config/environment.rb
from
file:/Users/pivotal/workspace/execwar/execwar.war!/jruby/rack/rails.rb:32:in
`load_environment’

Since jruby is successfully interpreting /jruby/rack/rails.rb, it
seems like it should be possible to interpret
/WEB-INF/config/environment.rb as well. Can we force the usage of the
“file:/…/execwar.war!/…” format to locate and load the
environment.rb file?

We’ve created a sample rails app to illustrate this problem.
Instructions for compiling and running the war are in the README:

http://github.com/pivotal/execwar

Thanks,
– Chad


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

seems there is a bug in the JRuby-Rack development version, I don’t know
if
you are using it but when I execute its tests I get:

NativeException in 'Java::OrgJrubyRackRails::RailsRackApplicationFactory

/opt/jruby-1.3.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in
instance_eval' from /opt/jruby-1.3.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:ininitialize’
from :2
org/jruby/rack/DefaultRackApplicationFactory.java:153:in `init’

That’s pretty similar to what you get in your app. In theory you could
override your RAILS_ROOT to use “execwar.war!/WEB-INF” adding it to the
warble.rb with this option “config.webxml.rails.root =
‘/execwar.war!/WEB-INF’”, but I did it in your sample app and it doesn’t
work at all.

Just remember another thing.

I moved some jruby on rails applications to Jetty 7 recently and I had
some
initialization issues because I tryed to load a spring context in a
rails
initializer but the variable $servlet_context hadn’t been initialized
when
that code ran.

I solved it moving my code to a method and initialized the spring
context on
demand but perhaps you could try to use Jetty 6 and see what happens.

On Thu, Oct 29, 2009 at 10:56 AM, David C.

On Thu, Oct 29, 2009 at 3:34 AM, David C.
[email protected] wrote:

Just remember another thing.

I moved some jruby on rails applications to Jetty 7 recently and I had some
initialization issues because I tryed to load a spring context in a rails
initializer but the variable $servlet_context hadn’t been initialized when
that code ran.

I solved it moving my code to a method and initialized the spring context on
demand but perhaps you could try to use Jetty 6 and see what happens.

Yes, we got that error until we defined this in Main.java:

context.setResourceBase(“”);

Then it went away. It seemed to be because Jetty couldn’t determine
the real root path / resource base automatically.

Thanks
– Chad


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email