Using embedded ruby in servlet filter

Hi,

I’ve successfully deployed a tomcat app using a servlet filter that uses
jruby to manipulate the session data. I’m following the code ideas
presented
here:
http://wiki.jruby.org/wiki/Direct_JRuby_Embedding#Ruby_code_in_your_classpath.2C_Mixed_with_java

I’m using the exact RubyLauncher class.

Using the latest (1.1.5) jruby.jar

The code in my “ruby” needed to use the standard net::http library.
Using
the jruby.jar didn’t seem to find net/http. So I switched from jruby.jar
to
jruby-complete.jar. Now, I only get this error:

org.jruby.exceptions.RaiseException
(unknown).method_added(file:/usr/local/apache-tomcat-6.0.16/webapps/xtf-2.1.1/WEB-INF/lib/jruby-complete-1.1.5.jar!/builtin/javasupport/core_ext/object.rb:110)
Module.const_missing(:4)
Bootstrap.execute(:7)
(unknown).(unknown)(:1)

Even after commenting all of my ruby code out (except for the skeleton
class) I get that error. Anyone know what this is coming from? Is there
a
better way to implement a ruby servlet filter in jruby?

Thanks!

Matt

Try editing lib/ruby/builtin/javasupport/core_ext/object.rb and add
something to print out what constant it is trying to load which is
giving you the problems.
Another thing you could add there is a begin/rescue around
method_added_without_import_checking to see what the exact
RaiseException is. Once you change this file in your source tree you
will need to regenerate you jruby-complete.jar.

-Tom

On Tue, Nov 11, 2008 at 11:00 PM, Matt M. [email protected]
wrote:

Even after commenting all of my ruby code out (except for the skeleton
class) I get that error. Anyone know what this is coming from? Is there a
better way to implement a ruby servlet filter in jruby?

Thanks!

Matt


Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: [email protected] , [email protected]


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi Tom,

I tried this out. In the method_added(name), I printed out the names. A
big
long list of method names were spit out, “execute” being the last. I
also
tried wrapping a begin/rescue around the body of the method and it never
actually executed the rescue block. I know this isn’t very helpful, but
I’m
not sure what else to do? Any other suggestions?

Thanks for your help.
Matt

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs