Problem using Activesupport rescuable in a PORO

Hi experts,

I want to use ActiveSupport::Rescuable in my PORO that lives in lib/
directory of a Rails 3.0.4 app.

The invocation is something like this:

require ‘java’

rescue_from java.lang.NullPointerException,
java.lang.IllegalArgumentException,
:with => :handle_config_error

But I get this when I start up Rails:

=> Rails 3.0.4 application starting in development on http://0.0.0.0:80
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
ArgumentError: Java::JavaLang::NullPointerException is neither an
Exception nor a String
rescue_from at
/opt/tms/bin/jruby-1.6.0.RC3/lib/ruby/gems/1.8/gems/activesupport-3.0.4/lib/active_support/rescuable.rb:67

           each at org/jruby/RubyArray.java:1572
     rescue_from at

/opt/tms/bin/jruby-1.6.0.RC3/lib/ruby/gems/1.8/gems/activesupport-3.0.4/lib/active_support/rescuable.rb:61

How do I get rid of this problem?

Best,
Radhesh

Radhesh K. wrote in post #990445:

Hi experts,

I want to use ActiveSupport::Rescuable in my PORO that lives in lib/
directory of a Rails 3.0.4 app.

The invocation is something like this:

require ‘java’

rescue_from java.lang.NullPointerException,
java.lang.IllegalArgumentException,
:with => :handle_config_error

But I get this when I start up Rails:

=> Rails 3.0.4 application starting in development on http://0.0.0.0:80
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
ArgumentError: Java::JavaLang::NullPointerException is neither an
Exception nor a String

I do not get this error above when I just decide to rescue_from
NativeException. Although this is useful, it would be nice to rescue
from different (Java) exceptions in different ways (e.g., catch my
custom java exceptions in different ways depending on what exception it
is).

Is there a workaround where I could catch the others?

Best,
Radhesh