{"id":175,"date":"2006-03-16T06:18:41","date_gmt":"2006-03-16T05:18:41","guid":{"rendered":"http:\/\/www.malcolmhardie.com\/weblogs\/angus\/?p=175"},"modified":"2025-02-01T03:04:16","modified_gmt":"2025-02-01T03:04:16","slug":"finding-and-fixing-stackoverflowerror-in-java","status":"publish","type":"post","link":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/2006\/03\/16\/finding-and-fixing-stackoverflowerror-in-java\/","title":{"rendered":"Finding and fixing StackOverFlowError in java"},"content":{"rendered":"<p>I was having a problem with some java one day, I&#8217;d made a change to some code and I kept getting a StackOverflowError. Unfortunately the stack trace didn&#8217;t help and some time inspecting the code didn&#8217;t offer any quick solutions. So I turned obviously to <a href=\"http:\/\/www.google.com\/search?q=java.lang.StackOverflowError+locate&#038;btnG=Search&#038;hl=en\">Google<\/a>. The answer was simple, although it took some work to find it.<\/p>\n<p>If you get a StackOverflowError in java it can sometimes be difficult to identify where the problem is occurring. This is because in some versions of the JVM the relevant stack trace isn&#8217;t automatically provided. This is the case in 1.4.2 when using the JIT compiler. (which I was)<\/p>\n<p>One work around that worked for me was to add the -Xint option to the java call. This forces the JVM to use interpret the code rather than attempt to compile it. The interpreter will provide a stack trace and the problem can be easily found and fixed.<\/p>\n<p>The bug report that gave the answer is at Sun:<br \/>\n<a href=\"http:\/\/bugs.sun.com\/bugdatabase\/view_bug.do?bug_id=4872096\">Bug Report<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was having a problem with some java one day, I&#8217;d made a change to some code and I kept getting a StackOverflowError. Unfortunately the stack trace didn&#8217;t help and some time inspecting the code didn&#8217;t offer any quick solutions. So I turned obviously to Google. The answer was simple, although it took some work [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,10],"tags":[],"class_list":["post-175","post","type-post","status-publish","format-standard","hentry","category-general","category-macintosh"],"_links":{"self":[{"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/posts\/175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/comments?post=175"}],"version-history":[{"count":1,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/posts\/175\/revisions"}],"predecessor-version":[{"id":1512,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/posts\/175\/revisions\/1512"}],"wp:attachment":[{"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/media?parent=175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/categories?post=175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/tags?post=175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}