Rails: Rack + AOT --> RackInitializationException: IO error


#1

Hi,

I’m trying to deploy a very simple RoR application into a Glassfish
Server.
The problem here is that I need to protect my source code somehow, so
I’ve
compiled all models and controllers with jrubyc, hacked active_support
dependencies.rb to accept requiring .class files and removed all .rb
files.
So far I’ve been able to launch webbrick (jruby script/server) and it
works
fine.
I’ve packed the application into a war with warble, and deployed it into
Glassfish.
And when I try to access the app, I get this error:

[#|2008-11-05T12:38:39.740+0100|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=22;_ThreadName=httpSSLWorkerThread-57151-1;_RequestID=ab6f35e2-2e2c-42f6-80d1-01e836ed06b8;|WebModule[/test]Exception
caught org.jruby.rack.RackInitializationException: IO error –
/root/glassfishv2/domain1/applications/j2ee-modules/test/WEB-INF/app/controllers/application
from
/root/glassfishv2/domain1/applications/j2ee-modules/test/WEB-INF/
vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/
callbacks.rb:177:in call' from /root/glassfishv2/domain1/applications/j2ee-modules/test/WEB-INF/ vendor/rails/activerecord/lib/../../activesupport/lib/active_support/ callbacks.rb:177:inevaluate_method’
from
/root/glassfishv2/domain1/applications/j2ee-modules/test/WEB-INF/
vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/
callbacks.rb:161:in call' from /root/glassfishv2/domain1/applications/j2ee-modules/test/WEB-INF/ vendor/rails/activerecord/lib/../../activesupport/lib/active_support/ callbacks.rb:90:inrun’
from
/root/glassfishv2/domain1/applications/j2ee-modules/test/WEB-INF/
vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/
callbacks.rb:90:in each' from /root/glassfishv2/domain1/applications/j2ee-modules/test/WEB-INF/ vendor/rails/activerecord/lib/../../activesupport/lib/active_support/ callbacks.rb:90:inrun’
from
/root/glassfishv2/domain1/applications/j2ee-modules/test/WEB-INF/
vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/
callbacks.rb:272:in run_callbacks' from /root/glassfishv2/domain1/applications/j2ee-modules/test/WEB-INF/ config/../vendor/rails/railties/lib/initializer.rb:483:inprepare_dispatcher’
… 7 levels…
from
/root/glassfishv2/domain1/generated/jsp/j2ee-modules/test/loader/
rack/builder.rb:22:in instance_eval' from /root/glassfishv2/domain1/generated/jsp/j2ee-modules/test/loader/ rack/builder.rb:22:ininitialize’
from :3

  at org.jruby.rack.DefaultRackApplicationFactory

$4.init(DefaultRackApplicationFactory.java:154)
at
org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:
53)
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:
230)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
198)

I think JRuby Rack is trying to parse controllers/application but it
can’t,
mainly because it is in java bytecode. After looking a little to the
rack’s
code, the little I could understand is that it’s trying to include all
rails
app as ruby code, and then let jruby JIT compile it.
Has anyone got into this problem before? Is there any configuration I
can
use to solve this? Is it planned to make rack accept AOT code?
I’m using jruby-complete-1.1.4.jar and jruby-rack-0.9.2.jar for
glassfish
and jruby-1.1.5 for webbrick.

Thanks for your time,

Raimon Malatesta


#2

Can anyone help me on this? Or am I writing in the wrong place?

Thanks again,

RaY

2008/11/10 RaY removed_email_address@domain.invalid


#3

You’re in the right place, I’m not sure anyone’s seen your problem.
Have you looked on the wiki for tips on pre-compiling ruby scripts? It
would seem to be related to JRuby support for loading only
pre-compiled scripts, and I’m not sure if anyone else has reported
100% success on precompiling a Rails app.

Could there be classloader or security issues that are taking place
inside Glassfish that aren’t happening inside Mongrel?

/Nick

On Wed, Nov 12, 2008 at 7:19 AM, RaY removed_email_address@domain.invalid wrote:

I’m trying to deploy a very simple RoR application into a Glassfish
[#|2008-11-05T12:38:39.740+
vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/
/root/glassfishv2/domain1/applications/j2ee-modules/test/WEB-INF/
from
from :3
92)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
and jruby-1.1.5 for webbrick.

Thanks for your time,

Raimon Malatesta


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#4

I will also add that I do not think you needed to hack anything to
load those compiled files. They should have loaded so long as they
were in your classpath.

-Tom

On Wed, Nov 12, 2008 at 9:37 AM, Nick S. removed_email_address@domain.invalid
wrote:

/root/glassfishv2/domain1/applications/j2ee-modules/test/WEB-INF/
from
callbacks.rb:272:in run_callbacks' rack/builder.rb:22:ininitialize’
org.jruby.rack.PoolingRackApplicationFactory.getApplication(PoolingRackApplicationFactory.java:

I’m using jruby-complete-1.1.4.jar and jruby-rack-0.9.2.jar for glassfish
http://xircles.codehaus.org/manage_email


Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: removed_email_address@domain.invalid , removed_email_address@domain.invalid


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#5

Thanks,

I think the problem may be in jruby rack, not with Glassfish, the
exception is rised when trying to read the compiled ruby scripts. I
will try it on Tomcat too, and see what I can get. I haven’t tried
with mongrel neither. I will see what I can find and post the results.
In the wiki there is a little explanation I followed to get where I am
right now.
I’ll keep researching.

Thanks again,

RaY

El 12/11/2008, a las 16:37, Nick S.
escribió:

I’ve packed the application into a war with warble, and deployed
;_ThreadName
active_support/
callbacks.rb:161:in `call’
from
/root/glassfishv2/domain1/applications/j2ee-modules/test/WEB-INF/

 at

.rack.DefaultRackDispatcher.process(DefaultRackDispatcher.java:
230)
can’t, mainly because it is in java bytecode. After looking a


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email