You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to post many observations to FROST. Sometimes for one batch request out of many I get a 500 error code saying there is no such method. This happens around 10% of the time. I am not seeing any pattern in the data I am posting.
I do see that the error includes a reference to LngLatAltDeserializer. I don't believe my latitude / longitude values are wrong. It throws the error when I pass 42.49652778, -121.006925 which is valid.
If I missed something and there is something incorrect in my request body, I would have expected a different error.
The full raw error code returned in the HTTP request is as follows:
<!doctype html><html lang="en"><head><title>HTTP Status 500 \xe2\x80\x93 Internal Server Error</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 \xe2\x80\x93 Internal Server Error</h1><hr class="line" /><p><b>Type</b> Exception Report</p><p><b>Message</b> Servlet execution threw an exception</p><p><b>Description</b> The server encountered an unexpected condition that prevented it from fulfilling the request.</p><p><b>Exception</b></p><pre>javax.servlet.ServletException: Servlet execution threw an exception\n\torg.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:331)\n\torg.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:158)\n\torg.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)\n</pre><p><b>Root Cause</b></p><pre>java.lang.NoSuchMethodError: 'com.fasterxml.jackson.databind.JsonMappingException com.fasterxml.jackson.databind.DeserializationContext.mappingException(java.lang.String)'\n\torg.geojson.jackson.LngLatAltDeserializer.extractDouble(LngLatAltDeserializer.java:64)\n\torg.geojson.jackson.LngLatAltDeserializer.deserializeArray(LngLatAltDeserializer.java:27)\n\torg.geojson.jackson.LngLatAltDeserializer.deserialize(LngLatAltDeserializer.java:18)\n\torg.geojson.jackson.LngLatAltDeserializer.deserialize(LngLatAltDeserializer.java:13)\n\tcom.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)\n\tcom.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)\n\tcom.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:215)\n\tcom.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:187)\n\tcom.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:170)\n\tcom.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:136)\n\tcom.fasterxml.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:263)\n\tcom.fasterxml.jackson.databind.deser.impl.TypeWrappedDeserializer.deserialize(TypeWrappedDeserializer.java:74)\n\tcom.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:342)\n\tcom.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:4875)\n\tcom.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3033)\n\tcom.fasterxml.jackson.core.JsonParser.readValueAs(JsonParser.java:2367)\n\tde.fraunhofer.iosb.ilt.frostserver.json.deserialize.custom.GeoJsonDeserializier.deserialize(GeoJsonDeserializier.java:49)\n\tde.fraunhofer.iosb.ilt.frostserver.json.deserialize.custom.CustomEntityDeserializer.deserializeEntityProperty(CustomEntityDeserializer.java:177)\n\tde.fraunhofer.iosb.ilt.frostserver.json.deserialize.custom.CustomEntityDeserializer.deserializeProperty(CustomEntityDeserializer.java:150)\n\tde.fraunhofer.iosb.ilt.frostserver.json.deserialize.custom.CustomEntityDeserializer.deserialize(CustomEntityDeserializer.java:129)\n\tde.fraunhofer.iosb.ilt.frostserver.json.deserialize.custom.CustomEntityDeserializer.deserializeNavigationProperty(CustomEntityDeserializer.java:164)\n\tde.fraunhofer.iosb.ilt.frostserver.json.deserialize.custom.CustomEntityDeserializer.deserializeProperty(CustomEntityDeserializer.java:152)\n\tde.fraunhofer.iosb.ilt.frostserver.json.deserialize.custom.CustomEntityDeserializer.deserialize(CustomEntityDeserializer.java:129)\n\tde.fraunhofer.iosb.ilt.frostserver.json.deserialize.custom.CustomEntityDeserializer.deserializeFull(CustomEntityDeserializer.java:105)\n\tde.fraunhofer.iosb.ilt.frostserver.json.deserialize.JsonReader.parseEntity(JsonReader.java:132)\n\tde.fraunhofer.iosb.ilt.frostserver.service.Service.handlePost(Service.java:480)\n\tde.fraunhofer.iosb.ilt.frostserver.service.Service.executePost(Service.java:423)\n\tde.fraunhofer.iosb.ilt.frostserver.service.Service.execute(Service.java:159)\n\tde.fraunhofer.iosb.ilt.frostserver.plugin.coremodel.PluginCoreService.execute(PluginCoreService.java:139)\n\tde.fraunhofer.iosb.ilt.frostserver.plugin.batchprocessing.BatchProcessor.processHttpRequest(BatchProcessor.java:85)\n\tde.fraunhofer.iosb.ilt.frostserver.plugin.batchprocessing.BatchProcessor.processBatch(BatchProcessor.java:177)\n\tde.fraunhofer.iosb.ilt.frostserver.plugin.batchprocessing.ServiceBatchProcessing.executeBatchOperation(ServiceBatchProcessing.java:77)\n\tde.fraunhofer.iosb.ilt.frostserver.plugin.batchprocessing.PluginBatchProcessing.execute(PluginBatchProcessing.java:105)\n\tde.fraunhofer.iosb.ilt.frostserver.http.common.ServletMain.executeService(ServletMain.java:113)\n\tde.fraunhofer.iosb.ilt.frostserver.http.common.ServletMain.processRequest(ServletMain.java:95)\n\tde.fraunhofer.iosb.ilt.frostserver.http.common.ServletMain.doPost(ServletMain.java:140)\n\tjavax.servlet.http.HttpServlet.service(HttpServlet.java:555)\n\tde.fraunhofer.iosb.ilt.frostserver.http.common.ServletMain.service(ServletMain.java:173)\n\tjavax.servlet.http.HttpServlet.service(HttpServlet.java:623)\n\torg.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:331)\n\torg.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:158)\n\torg.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)\n</pre><p><b>Note</b> The full stack trace of the root cause is available in the server logs.</p><hr class="line" /><h3>Apache Tomcat/9.0.91</h3></body></html>
The observation format I am sending is coming from Python HTTP request and matches the format of the following: (obviously this is just the sensorthings part, not the whole request)
defto_sensorthings_observation(
attr: Attributes, datapoint: Optional[float], resultTime: str, phenom_time: str, id: int
) ->Observation:
"""Return the json body for a sensorthings observation insert to FROST"""return {
"phenomenonTime": phenom_time,
"resultTime": resultTime,
"Datastream": {"@iot.id": int(f"{attr['station_nbr']}{id}")},
"result": datapoint,
"FeatureOfInterest": {
"@iot.id": attr["station_nbr"],
"name": attr["station_name"],
"description": attr["station_name"],
"encodingType": "application/vnd.geo+json",
"feature": {
"type": "Point",
"coordinates": [
attr["longitude_dec"],
attr["latitude_dec"],
attr["elevation"],
],
},
},
}
The text was updated successfully, but these errors were encountered:
The mapping exception is confusing, the actual error is: "Unexpected token (" + token.name() + ") when binding data into LngLatAlt"
Unfortunately we can't see what token.name is, but there is an error in your JSON.
My guess is that one of your rows is missing one of the properties, leading to incorrect JSON. This is the main reason you should avoid generating raw json, it is very error prone.
I do see that the error includes a reference to LngLatAltDeserializer. I don't believe my latitude / longitude values are wrong. It throws the error when I pass 42.49652778, -121.006925 which is valid.
This actually clearly points to your problem. Your code should always return three values, never two. So your JSON probably contains [ 42.49652778, -121.006925, ]
Notice the trailing comma.
Unfortunately we can't see what token.name is, but there is an error in your JSON.
Ok sounds good thank you. I will take another look. I believe I have all three values, just forgot to paste altitude as I was print debugging. I will update this here if I gain any insight as I look back and get the full request.
This is the main reason you should avoid generating raw json, it is very error prone.
Ah makes sense. I actually did not realize there is a Python client until now. Will look to getting away from raw json.
I am trying to post many observations to FROST. Sometimes for one batch request out of many I get a 500 error code saying there is no such method. This happens around 10% of the time. I am not seeing any pattern in the data I am posting.
I do see that the error includes a reference to
LngLatAltDeserializer
. I don't believe my latitude / longitude values are wrong. It throws the error when I pass 42.49652778, -121.006925 which is valid.If I missed something and there is something incorrect in my request body, I would have expected a different error.
The full raw error code returned in the HTTP request is as follows:
The observation format I am sending is coming from Python HTTP request and matches the format of the following: (obviously this is just the sensorthings part, not the whole request)
The text was updated successfully, but these errors were encountered: