Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6184343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:31:14+00:00 2026-05-24T01:31:14+00:00

I have a StackOverflowError in Java and it doesn’t tell me any line in

  • 0

I have a StackOverflowError in Java and it doesn’t tell me any line in my own code, the relevant part of the stacktrace is:

java.lang.StringBuilder.append(StringBuilder.java:132)
java.util.AbstractMap.toString(AbstractMap.java:523)
java.lang.String.valueOf(String.java:2838)
java.lang.StringBuilder.append(StringBuilder.java:132)
java.util.AbstractCollection.toString(AbstractCollection.java:439)
java.lang.String.valueOf(String.java:2838)

I’ve tried getting the stack trace from the throwable, but for some reason it doesn’t contain the relevant nodes, I’m trying to find some inpoint in my code as to where the error is. Also I’ve tried to reduce the stack size to 128k to get the error earlier, no avail.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:31:15+00:00Added an answer on May 24, 2026 at 1:31 am

    For a StackOverFlowError, the stack trace is often truncated (since it is too long), which does not really help finding the error.

    In your case, assuming the part you copied is the one which is repeating, it looks like you added a map to a collection, which in turn is a as a key or value of the original map, and then use the toString() method on one of these objects.

    The default implementation of toString() for a map (in AbstractMap) then calls StringBuilder.append(...) with all its keys and values, which in turn will invoke toString on these. For AbstractCollection, the same is valid for the elements of the collection.

    (The example in Jon’s answer does a similar thing with two collections instead of a map and a collection.)

    Solutions:

    • Remove the cycles in your collection/map graph.
    • If you need cycles in your collection/map-graph:
      • avoid calling toString() (and hashCode/equals, too), or
      • override the toString() method of one of them to break the cycle.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have you guys had any experiences (positive or negative) by placing your source code/solution
Have you ever seen any of there error messages? -- SQL Server 2000 Could
I have an applet, which I was writing in Java. Recently, I thought that
I'm battling an error I don't quite understand. I have a class in Java,
is there any way to have a tail-recursive function inside CPS not throwing a
I have a Java application that parses a large xml schema (.xsd) using Xerces
Have a look at this code: #include <iostream> using namespace std; int main() {
We have a Java server back-end that uses Apache XML-RPC to make its services
I have a Java application that is working as a service. After several days
i have create some xml layout and i java files, some xml file have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.