I’m fairly new to JRuby, so pardon me if this has been covered before,
but I’m working on integrating a Rack app
(jruby-core-1.5.6+jruby-rack-1.0.5) with some java code into a warbler’s
WAR deployed on GlassFishv3 and I’m having trouble getting Java Native
Exception thrown but not handled by the JRuby layer to be logged on the
I tried setting:
but that doesn’t seem to work although I have slf4j working from the
If I manually log the exception in Java before throwing to JRuby it
seems to go through (1) a JRuby stack and then (2) the RackFilter:
java.lang.RuntimeException: This is an exception
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
I tried plugging my own ServletFilter before the RackFilter to catch and
log exceptions, but the exception doesn’t seem to propagate outside of
the RackFilter’s scope, so somewhere in between it appears to be
consumed… by who?
I looked at the RackFilter.doFilter code and it doesn’t seem to
try/catch anything, so the exception looks consumed within the JRuby
I looked at
it seems to wrap Exceptions into RaiseException and rethrow…
JavaCallable.handleThrowable states // This point is only reached if
there was an exception handler installed
Is there a way to configure a custom exception handler in JRuby?
I’m basically looking for a way to ensure any Exception not caught in
ruby code is reported in the server.log.