Java. Lang. stackoverflowerror (internal_server_error, HTTP Error 500)

Source: Internet
Author: User
   

Actually. I made a mistake when calling a function at the DaO layer. I called myself.

A java. Lang. stackoverflowerror error occurs in the recently executed project. After a long time, I also asked experts and checked information. Finally, the problem is solved! Special record!

Stackoverflowerror is because the current thread's stack is fullWhich is caused by too many function call levels.

For example, dead recursion.

For example:

 Public String homepage (){
  This. findallnews ();
   Return "shouye ";
 }

 

PublicString findallnews (){
  List newslist = hotnewsservice. findall ();
  HotnewsdtoHotnews = (hotnewsdto) newslist. Get (0); // get the first news
  Stringcontent = hotnews. getcontent ();
  Stringsubcontent = content. substring (0, 80); // the content of this news clip is displayed on the homepage.
  Super. setrequestattribute ("hotnews", hotnews );
  Super. setrequestattriist ("newslist", newslist );
  Super. setrequestattribute ("subcontent", subcontent );
   Return homepage;

  }

 A method called like a red mark is equivalent to an infinite loop!

Solution:

 I used to set the return value of the findallnews method to void.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.