Note that there are some explanatory texts on larger screens.

plurals
  1. POGSON error in Play framework 1.2.5
    text
    copied!<p>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 ?</p> <p>There has to be a solution to this, without swapping out json parsers or writing your own.</p> <p>Company.java</p> <pre><code>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&lt;Worksheet&gt; worksheets; } } </code></pre> <p>and</p> <p>Worksheet.java</p> <pre><code>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; ... } </code></pre> <p>In my controller, I just run this :</p> <pre><code>List&lt;Company&gt; companies = Company.FindAll(); renderJSON(companies); </code></pre> <p>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 :</p> <pre><code>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) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload