I get a stack dump in jruby, 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 received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jeremy Walker
2012-May-02 16:25 UTC
Re: jruby/rack stack dumps without reference to my code
On 2 May 2012 17:00, Jedrin <jrubiando-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I get a stack dump in jruby, > > 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. Of course, it could be nothing to do with that! :) Jeremy Walker -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 2 May 2012 17:00, Jedrin <jrubiando-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I get a stack dump in jruby, > > 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. Colin> > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.