it will say: org.jruby.exceptions.RaiseException: (NoMethodError)
undefined method `log' for nil:NilClass
and then print out a lengthy stack dump. None of the source code lines
given however come from any of my code so I am not sure how to figure
out what is causing the dump or how to change the stack dump.
You may well have a variable that you expect to be set, that is actually nil. When some other code then comes to use that variable later on, it is trying to call the log method on nil. The actual line that is setting the variable to nil isn’t in the stack trace because it didn’t throw an error. I’d check your code carefully for anything that might be set to nil. Maybe use a debugger to step through the code and check the values of everything.
it will say: org.jruby.exceptions.RaiseException: (NoMethodError)
undefined method `log' for nil:NilClass
and then print out a lengthy stack dump. None of the source code lines
given however come from any of my code so I am not sure how to figure
out what is causing the dump or how to change the stack dump.
Tell us what you do to generate the error and post the full error text
and the stack dump.
Here is a typical stack dump I get. It's looking for a log method on a
nil class. none of it is in my code.
This is a sinatra app. Sinatra seems to not do a good job of tracing
compared to rails is my experience thus far
Application Error
org.jruby.exceptions.RaiseException: (NoMethodError) undefined method
`log' for
nil:NilClass
at ServletLog.write(file:c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/
jruby-rac
k-1.1.1/lib/jruby-rack-1.1.1.jar!/jruby/rack/servlet_log.rb:18)
at CommonLogger.log(c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/
rack-1.3.1/lib
/rack/commonlogger.rb:39)
at CommonLogger.call(c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/
rack-1.3.1/li
b/rack/commonlogger.rb:22)
at org.jruby.RubyProc.call(org/jruby/RubyProc.java:270)
at org.jruby.RubyProc.call(org/jruby/RubyProc.java:220)
at BodyProxy.close(c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/
rack-1.3.1/lib/
rack/body_proxy.rb:16)
at Response.write_body(file:c:/jruby-1.6.7/lib/ruby/gems/1.8/
gems/jruby-
rack-1.1.1/lib/jruby-rack-1.1.1.jar!/jruby/rack/response.rb:111)
at Response.respond(file:c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/
jruby-rac
k-1.1.1/lib/jruby-rack-1.1.1.jar!/jruby/rack/response.rb:50)
org.jruby.exceptions.RaiseException: (NoMethodError) undefined method
`log' for
nil:NilClass
at ServletLog.write(file:c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/
jruby-rac
k-1.1.1/lib/jruby-rack-1.1.1.jar!/jruby/rack/servlet_log.rb:18)
at CommonLogger.log(c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/
rack-1.3.1/lib
/rack/commonlogger.rb:39)
at CommonLogger.call(c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/
rack-1.3.1/li
b/rack/commonlogger.rb:22)
at org.jruby.RubyProc.call(org/jruby/RubyProc.java:270)
at org.jruby.RubyProc.call(org/jruby/RubyProc.java:220)
at BodyProxy.close(c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/
rack-1.3.1/lib/
rack/body_proxy.rb:16)
at Response.write_body(file:c:/jruby-1.6.7/lib/ruby/gems/1.8/
gems/jruby-
rack-1.1.1/lib/jruby-rack-1.1.1.jar!/jruby/rack/response.rb:111)
at Response.respond(file:c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/
jruby-rac
k-1.1.1/lib/jruby-rack-1.1.1.jar!/jruby/rack/response.rb:50)
I am also using sinatra with this thing called trinidad which is some
kind of web server. When I use web brick I seem to not have soany
problems in this regard. I am not sure why they wanted me to use
trinidad