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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
473309c9a62a95bb9b0b3382815cdac6?d=identicon&s=25 RaY (Guest)
on 2008-11-10 11:23
(Received via mailing list)
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:in `evaluate_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:in `run'
      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:in `run'
      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:in
`prepare_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:in `initialize'
      from <script>: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
473309c9a62a95bb9b0b3382815cdac6?d=identicon&s=25 RaY (Guest)
on 2008-11-12 14:20
(Received via mailing list)
Can anyone help me on this? Or am I writing in the wrong place?

Thanks again,

RaY

2008/11/10 RaY <graimon@gmail.com>
526d60de6472502bb570a9df2842b33b?d=identicon&s=25 Nick Sieger (Guest)
on 2008-11-12 16:38
(Received via mailing list)
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 <graimon@gmail.com> 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 <script>: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
13313ac2ec7ba7c43b1b952db034ff3b?d=identicon&s=25 Thomas E Enebo (Guest)
on 2008-11-12 16:47
(Received via mailing list)
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 Sieger <nicksieger@gmail.com>
wrote:
>
>>>
>>>
>>> /root/glassfishv2/domain1/applications/j2ee-modules/test/WEB-INF/
>>>       from
>>> callbacks.rb:272:in `run_callbacks'
>>> rack/builder.rb:22:in `initialize'
>>> 
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: enebo@acm.org , tom.enebo@gmail.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
473309c9a62a95bb9b0b3382815cdac6?d=identicon&s=25 Raimon Malatesta (Guest)
on 2008-11-12 16:50
(Received via mailing list)
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 Sieger
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
This topic is locked and can not be replied to.