をシリアル化!= nullを、私は次のエラーですjavax.measure.Quantityプロパティ
Caused by: java.lang.RuntimeException: com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: java.util.ArrayList[0]->tec.units.ri.Identity["conversionSteps"]->java.util.ArrayList[0]->tec.units.ri.Identity["conversionSteps"]-> ... (and so on))
at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.loadHttpMethod(ApacheHttpClient4Engine.java:430)
at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:281)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: java.util.ArrayList[0]->tec.units.ri.Identity["conversionSteps"]->java.util.ArrayList[0]->tec.units.ri.Identity["conversionSteps"]->java.util.ArrayList[0]->tec.units.ri.Identity["conversionSteps"]-> ... (and so on))
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:694)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:157)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:119)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:672)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:678)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:157)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:119)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18)
...
(and so on)
を取得します簡略化されたエンティティ...
import javax.measure.Quantity;
import javax.measure.quantity.Mass;
public class Compound {
private Quantity<Mass> regAmount;
public Quantity<Mass> getRegAmount() {
return regAmount;
}
public void setRegAmount(Quantity<Mass> regAmount) {
this.regAmount = regAmount;
}
}
これは私が値を設定する方法の例です:
Compound compound = new Compound();
double value = 1;
Unit<Mass> unit = Units.KILOGRAM;
Quantity<Mass> quantity = Quantities.getQuantity(value, unit);
compound.setRegAmount(quantity);
と、エラーがスローされた場合、この(数量せずに他のすべての20個のエンティティのために働く):
Builder builder = ClientBuilder.newClient()
.target(webServiceUrl)
.path(path)
.request(MediaType.APPLICATION_JSON);
Entity<E> e = Entity.json(entity); // works
response = builder.put(e); // error if regAmount != null
使用される技術:版ジャクソン、RESTEasyに、javax.measure.unit-API(。 1.0)、tec.units.unit里(版1.0.3)
質問:
- あなたは問題とどのようにこの問題を解決するには何か知っていますか?
- regAmountを設定する別の方法はありますか?
- さまざまなアプローチや技術をお勧めできますか?
ありがとうございます!