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

  • SEARCH
  • Home
  • 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 8897361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:19:19+00:00 2026-06-15T00:19:19+00:00

The bug seems to be a recursion bug, that Company asks for Worksheets which

  • 0

The bug seems to be a recursion bug, that Company asks for Worksheets which asks for Company again, which …. you get the drift. I have searched the internet and stack overflow for this, I found out why the error happens, but the solution is always write your own parser or use flexjson or some other. I just want to know if there is a solution to this, there has to be since play is quite popular and surely people are fetching Posts and comments in one operation, or aren’t they ?

There has to be a solution to this, without swapping out json parsers or writing your own.

Company.java

package models;

import java.util.*;
import javax.persistence.*;

import play.db.jpa.*;

@Entity
public class Company extends Model {
    public String name;
    public String address;
    public String city;
    public String zipcode;
    public String country;
    public String phonenumber;
    public String website;
    public String footer;
    public String maincontactperson;
    public String email;
    public String password;
    public Blob logo;
    @OneToMany(mappedBy = "company", cascade = CascadeType.ALL, orphanRemoval = true, fetch=FetchType.EAGER)
    public List<Worksheet> worksheets;


    }

}

and

Worksheet.java

package models;

import java.util.*;
import javax.persistence.*;

import play.db.jpa.*;

@Entity
public class Worksheet extends Model {
    public String contactname;
    public String name;
    public String address;
    public String phonenumber;
    public String city;
    public String email;
    public String partnumber;
    @Lob
    public String partdescription;
    public String password;
    public Date due_date;
    public Date in_date;
    @Lob
    public String notes;
    @ManyToOne(cascade=CascadeType.ALL)
    public Company company;
...
}

In my controller, I just run this :

List<Company> companies = Company.FindAll();
renderJSON(companies);

This works if there are no worksheets, but once there is a worksheet, it crashes with a mile long error message. Here is the top of it :

00:31:02,623 ERROR ~ 

@6cbn7gi1o
Internal Server Error (500) for request POST /companies/login

Execution exception
InvocationTargetException occured : null

play.exceptions.JavaExecutionException
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:239)
    at Invocation.HTTP Request(Play!)
Caused by: java.lang.reflect.InvocationTargetException
    at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:557)
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:508)
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
    ... 1 more
Caused by: java.lang.StackOverflowError
    at java.util.Date.getTimeImpl(Date.java:870)
    at java.util.Date.getTime(Date.java:866)
    at java.sql.Timestamp.getTime(Timestamp.java:126)
    at java.util.Calendar.setTime(Calendar.java:1076)
    at java.text.SimpleDateFormat.format(SimpleDateFormat.java:875)
    at java.text.SimpleDateFormat.format(SimpleDateFormat.java:868)
    at java.text.DateFormat.format(DateFormat.java:316)
    at com.google.gson.internal.bind.DateTypeAdapter.write(DateTypeAdapter.java:90)
    at com.google.gson.internal.bind.DateTypeAdapter.write(DateTypeAdapter.java:41)
    at com.google.gson.internal.bind.TypeAdapters$22$1.write(TypeAdapters.java:522)
    at com.google.gson.internal.bind.TypeAdapters$22$1.write(TypeAdapters.java:515)
....

    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195)
    at com.google.gson.Gson$FutureTypeAdapter.write(Gson.java:879)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195)
  • 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-06-15T00:19:21+00:00Added an answer on June 15, 2026 at 12:19 am

    IMHO this isn’t a bug, you have a recursion in your model and the framework can’t really know automatically how it should serialize the model.

    I usually solve this with the @Expose annotation. Add it to all the members you want to show up in your serialized JSON and create a helper method that does something like this:

        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        String json = gson.toJson(your_model_instance);
    

    Optionally you can also implement the JsonSerializer interface as suggested in the comment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an curious zombie bug that seems to have crept out of the
I have got a memory bug that seems to boil down to something happening
This seems like a bug to me... I accept that automatic properties, defined as
There seems to be a bug in a Wordpress PHP function that leaves whitespace
Very strange bug I can't seems to figure out. I am trying to get
It seems a bug of Yahoo Weather API that every time I send a
I am getting an odd intermittent bug that seems to ve related to the
it seems that i got a bug in python: (Python 2.7.3 (default, Apr 10
I'm trying to reproduce a bug that seems to appear when a user is
It seems there is a known bug in wsdl.exe, the tool that Visual Studio

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.