嗨,我尝试从我的Java客户端应用程序调用lastFM API时得到以下异常 . 我使用了jsonschema2pojo-maven-plugin来自动生成我的类 . 我需要lat和long字段(我不想忽略它们)json我试图读取如下:LastFM API Call . 有任何想法吗?

location: {geo:point: {geo:lat: "51.539739",geo:long: "-0.102676"}

线程“main”中的异常org.springframework.http.converter.HttpMessageNotReadableException:无法读取JSON:无法识别的字段“geo:point”(类imis.athena.client.lastfm.dto.Location),未在[资料来源:sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@6391b687; line:1,column:191](通过引用链:imis.athena.client.lastfm.dto.LastFMEventsDTO [“events”] - > imis.athena.client.lastfm.dto.Events [“event”] - > imis .athena.client.lastfm.dto.Event [ “场地”] - > imis.athena.client.lastfm.dto.Venue [ “位置”] - > imis.athena.client.lastfm.dto.Location [“地理:点”]);嵌套异常是org.codehaus.jackson.map.exc.UnrecognizedPropertyException:无法识别的字段“geo:point”(类imis.athena.client.lastfm.dto.Location),在[来源:sun.net.www]中未标记为可忽略.protocol.http.HttpURLConnection $ @ HttpInputStream 6391b687; line:1,column:191](通过引用链:imis.athena.client.lastfm.dto.LastFMEventsDTO [“events”] - > imis.athena.client.lastfm.dto.Events [“event”] - > imis .athena.client.lastfm.dto.Event [ “场地”] - > imis.athena.client.lastfm.dto.Venue [ “位置”] - > imis.athena.client.lastfm.dto.Location [“地理:在org.springframework的org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.readJavaType(MappingJacksonHttpMessageConverter.java:170)org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.read(MappingJacksonHttpMessageConverter.java:162)处点“”)位于org.springframework.web.client.RestTemplate.exe的org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:492)中的.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:94)(RestTemplate.java :447)atg.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:215)at imis.athena.client.lastfm.run.LastFMRunner.initiateApiRequests(LastFMRunner.j ava:53)at imis.athena.lastfm.run.LastFMRunner.initiateSpringContextAndRun(LastFMRunner.java:45)at imis.athena.client.lastfm.run.LastFMRunner.main(LastFMRunner.java:39)引起:org .codehaus.jackson.map.exc.UnrecognizedPropertyException:无法识别的字段“geo:point”(类imis.athena.client.lastfm.dto.Location),未标记为可忽略[来源:sun.net.www.protocol.http .HttpURLConnection $ @ HttpInputStream 6391b687; line:1,column:191](通过引用链:imis.athena.client.lastfm.dto.LastFMEventsDTO [“events”] - > imis.athena.client.lastfm.dto.Events [“event”] - > imis .athena.client.lastfm.dto.Event [ “场地”] - > imis.athena.client.lastfm.dto.Venue [ “位置”] - > imis.athena.client.lastfm.dto.Location [“地理:在org.codehaus的org.codehaus.jackson.map.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:53)org.codehaus org.codehaus的org.codehaus.jackson.map.deser.StdDeserializationContext.unknownFieldException(StdDeserializationContext.java:267)位于org.codehaus.jackson.map的org.codehaus.jackson.map.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:659)的.jackson.map.deser.std.StdDeserializer.reportUnknownProperty(StdDeserializer.java:673) .deser.BeanDeserializer.handleUnknownProperty(BeanDeserializer.java:1365)org.codehaus.jackson.map.deser.BeanDeserializer._handleUnknown(BeanDeserializer.java:725)org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanD) eserializer.java:703)org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580)org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299)org位于org.codehaus.jackson.map的org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:697)的.codehaus.jackson.map.deser.SettableBeanProperty $ MethodProperty.deserializeAndSet(SettableBeanProperty.java:414)位于org.codehaus.jackson.map.deser.SettableBeanProperty $ MethodProperty.deserializeAndSet的org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299)中的.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580) (SettableBeanProperty.java:414)atorg.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:697)位于org.codehaus.jackson.map的org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580) . deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:217)位于org.codehaus.jackson.map.deser.std的org.codehaus.jackson.map.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:194) . CollectionDeserializer.deserialize(CollectionDeserializer.java:30)atg.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299)at org.codehaus.jackson.map.deser.SettableBeanProperty $ MethodProperty.deserializeAndSet(SettableBeanProperty . java:414)org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:697)org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580)atg.codehaus .jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.j ava:299)org.codehaus.jackson.map.deser.SettableBeanProperty $ MethodProperty.deserializeAndSet(SettableBeanProperty.java:414)org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:697)at org位于org.codehaus.jackson.map.ObjectMapper.readValue的org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2732)的.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580) (ObjectMapper.java:1923)org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.readJavaType(MappingJacksonHttpMessageConverter.java:167)... 8更多

EDIT 有问题的java类

@JsonInclude(JsonInclude.Include.NON_NULL)@Generated(“com.googlecode.jsonschema2pojo”)@JsonPropertyOrder({“city”,“country”,“geo:point”,“postalcode”,“street”})公共课地点 {

/**
 * 
 */
@JsonProperty("city")
private String city;
/**
 * 
 */
@JsonProperty("country")
private String country;
/**
 * 
 */
@JsonProperty("geo:point")
private Geo_point geo_point;
/**
 * 
 */
@JsonProperty("postalcode")
private String postalcode;
/**
 * 
 */
@JsonProperty("street")
private String street;
private Map<String, Object> additionalProperties = new HashMap<String, Object>();

/**
 * 
 */
@JsonProperty("city")
public String getCity() {
    return city;
}

/**
 * 
 */
@JsonProperty("city")
public void setCity(String city) {
    this.city = city;
}

/**
 * 
 */
@JsonProperty("country")
public String getCountry() {
    return country;
}

/**
 * 
 */
@JsonProperty("country")
public void setCountry(String country) {
    this.country = country;
}

/**
 * 
 */
@JsonProperty("geo:point")
public Geo_point getGeo_point() {
    return geo_point;
}

/**
 * 
 */
@JsonProperty("geo:point")
public void setGeo_point(Geo_point geo_point) {
    this.geo_point = geo_point;
}

/**
 * 
 */
@JsonProperty("postalcode")
public String getPostalcode() {
    return postalcode;
}

/**
 * 
 */
@JsonProperty("postalcode")
public void setPostalcode(String postalcode) {
    this.postalcode = postalcode;
}

/**
 * 
 */
@JsonProperty("street")
public String getStreet() {
    return street;
}

/**
 * 
 */
@JsonProperty("street")
public void setStreet(String street) {
    this.street = street;
}

@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this);
}

@Override
public int hashCode() {
    return HashCodeBuilder.reflectionHashCode(this);
}

@Override
public boolean equals(Object other) {
    return EqualsBuilder.reflectionEquals(this, other);
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
    return this.additionalProperties;
}

@JsonAnySetter
public void setAdditionalProperties(String name, Object value) {
    this.additionalProperties.put(name, value);
}

}