Problems deploying an rails app to oc4j

Hello people,

I’m having a bad time deploying a simple scaffold rails app to an OC4j
app
server. I don’t know why, i’m having very weird class cast exceptions
when
trying to access my rails app beside the “Welcome aboard” page.

There is the error:

10/11/17 12:32:00.689 jruby-rack-example: 10.1.3.5.0 Started
10/11/17 12:32:59.380 jruby-rack-example: Servlet error
java.lang.ClassCastException: org.jruby.rack.RackFilter$2
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0)

This is a full log.

https://gist.github.com/gists/705362/edit

Do you guys have experienced something like that? I don’t know what else
to
try in order to get this error solved.

Thank you in advance for any help in this issue!

Vitor P.
http://vp.blog.br

On Thu, Nov 18, 2010 at 12:42 PM, Vitor P. [email protected]
wrote:

java.lang.ClassCastException: org.jruby.rack.RackFilter$2
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0)

This is a full log.

https://gist.github.com/gists/705362/edit

Do you guys have experienced something like that? I don’t know what else to
try in order to get this error solved.

Thank you in advance for any help in this issue!

Hi, this is an odd error that I haven’t seen before. What version of
the servlet API does your version of OC4J use? JRuby-Rack expects 2.5.

/Nick

This OC4J is Servlet API 2.4. I’m using jruby-rack 0.9.6, as explained
at
this post (

)
I was wondering that it could be something related to Servlet Spec, but
i
could get it deployed correctly at Tomcat 5.5 which is also Servlet 2.4.

The only glitch i’ve found using tomcat is this, but i don’t know if
that
would make any difference.

/home/vitor/tools/apache-tomcat-5.5.31/webapps/jruby-rack-example/WEB-INF/gems/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack.rb:17
warning: already initialized constant VERSION

I’m using warble 0.9.14, but i’m replacing the original jars (which also
gave me a similar error) with jruby-rack-0.9.6.jar and
jruby-complete-1.3.1.jar.

I don’t know what more to try. I’ve done everything pretty much standard
so
far, and in tomcat it simply work.

Thank you for your help!

Vitor P.
http://vp.blog.br

On Thu, Nov 18, 2010 at 5:37 PM, Vitor P. [email protected]
wrote:

warning: already initialized constant VERSION

I’m using warble 0.9.14, but i’m replacing the original jars (which also
gave me a similar error) with jruby-rack-0.9.6.jar and
jruby-complete-1.3.1.jar.

I don’t know what more to try. I’ve done everything pretty much standard so
far, and in tomcat it simply work.

I’m running out of ideas too. Couple more things to try:

  • Build jruby-rack from source – pull the 0.9.6 tag. Then if you want
    you can try tweaking the source. I suspect the issue with RackFilter$2
    is the “maybeAppendHtmlToPath” method. You could remove it and rebuild
    a new jar.
  • Try the org.jruby.rack.RackServlet instead. You’d change your
    web.xml to declare the servlet and its servlet-mapping, and remove the
    filter and filter-mapping. But in this case you’ll probably want to
    have a frontend to serve static assets. RackServlet can serve them but
    it won’t be very performant.

/Nick

Hello Nick,

I noticed that the problem only happens with the oc4j version 10.1.3.5 -
which is the latest version provided by oracle. When i deployed at
10.1.3.4
(which oracle doesn’t seems to provide a link to it), everything worked
as
expected.

I’m going to try your tips and i’ll post the results right away.

Thanks for your help and sorry for the late reply.

Vitor P.
http://vp.blog.br