知道为什么我会从以下代码中收到此错误吗?. . ..
PrintWriter writer = response.getWriter();
Collection<Alert> alerts = AppState.instance.bi.getBackend().getNewerAlerts(time);
System.out.println("Alerts size = " + alerts.size());
Gson gson = gsonBuilder.create();
gson.toJson(new AlertsResponse(alerts), AlertsResponse.class, writer);
java.util.LinkedHashMap$LinkedHashIterator.(Unknown Source) at java.util.LinkedHashMap$LinkedHashIterator.(Unknown Source) at java.util 的线程“http-bio-80-exec-11”java.lang.StackOverflowError 中的异常。 LinkedHashMap$ValueIterator.(Unknown Source) at java.util.LinkedHashMap$ValueIterator.(Unknown Source) at java.util.LinkedHashMap.newValueIterator(Unknown Source) at java.util.HashMap$Values.iterator(Unknown Source) at com. com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) 上 com.google.gson.internal 上的 google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:192)。 com.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89)。com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) 上 com.google.gson.internal 上的 google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195)。 bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) 在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) 在 com.google.gson.internal.bind.ObjectTypeAdapter.write (ObjectTypeAdapter.java:105) 在 com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) 在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89)在 com.google.gson.internal.bind。ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory .java:89) 在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) 在 com.google.gson.internal.bind.ObjectTypeAdapter.write(ObjectTypeAdapter.java:105) 在com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) 在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) 在 com.google.gson.internal .bind.ReflectiveTypeAdapterFactory$Adapter。在 com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) 在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory 写入(ReflectiveTypeAdapterFactory.java:195)$1.write(ReflectiveTypeAdapterFactory.java:89 ) 在 com.google.gson.internal.bind.ObjectTypeAdapter.write(ObjectTypeAdapter.java:105) 的 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195)。 gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) 在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) 在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory $Adapter.write(ReflectiveTypeAdapterFactory.java:195)在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory 的 com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) $1.write(ReflectiveTypeAdapterFactory.java:89) 在 com.google。 gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) 在 com.google.gson.internal.bind.ObjectTypeAdapter.write(ObjectTypeAdapter.java:105) 在 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) 在 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) 在 com.google.gson.internal.bind.ObjectTypeAdapter.write(ObjectTypeAdapter.java:105) 在 com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) 在 com。 google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) 在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) 在 com.google.gson.internal .bind.TypeAdapterRuntimeTypeWrapper。在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory 上写(TypeAdapterRuntimeTypeWrapper.java:68)$1.write(ReflectiveTypeAdapterFactory.java:89)在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java :195) 在 com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) 在 com.google.com.google.gson.internal.bind.ObjectTypeAdapter.write(ObjectTypeAdapter.java:105)。 gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) 在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195)java:89) 在 com.google.gson.internal.bind.ObjectTypeAdapter.write(ObjectTypeAdapter.java:105) 在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) 在 com .google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) 在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) 在 com.google.gson.internal。 bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195)java:89) 在 com.google.gson.internal.bind.ObjectTypeAdapter.write(ObjectTypeAdapter.java:105) 在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) 在 com .google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) 在 com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) 在 com.google.gson.internal。 bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195)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)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)