excel upload in springboot qraphql - spring

This is the full endpoint
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of java.util.LinkedHashMap (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('{')
at [Source: (String)""{ "query": "mutation ($file: Upload) {uploadRegionData(file: $file)}" , "variables": {}}""; line: 1, column: 1]
iam getting this error!!!
any idea to resolve it

Related

Debezium Outbox Event Router - error with nested objects in payload

I'm getting an error using the Debezium Outbox Event Router (Postgres connector) when the JSON payload has nested objects and i use the option expand.json.payload: true.
Payload example:
{"Id": "8767ee4f-ef77-4128-a4eb-9a8fc8490d64", "Data": {"Name": "John"}}
With this payload I get the following error in the connector:
Caused by: org.apache.kafka.common.errors.SerializationException: Error serializing Avro message
Caused by: org.apache.avro.SchemaParseException: Can't redefine: io.confluent.connect.avro.ConnectDefault
If the payload has only simple properties, then there is no issue. Example:
{"Id": "8767ee4f-ef77-4128-a4eb-9a8fc8490d64", "Data": "John"}
As far as I understand this has to with the fact the JSON expander does not create a named schema for the nested objects.
Is there any way to overcome this?

JsonParseException: Invalid JSON input. Position: 9. Character: '.'

I am using MongoDB with Spring Boot 2.0.1.RELEASE. Everything seems to be working fine. I am able to perform CRUD operations properly using MongoRepository. When I use mongodb query in like
#Query(value = "{address.city:?0}")
public List<Hotel> findByCity(String city);
#Query(value = "{address.country:?0}")
public List<Hotel> findByCountry(String country);
When I try to access data using the url localhost:8090/hotels/address/city/Rome, I get the following error in response
{
"timestamp": "2018-05-04T04:51:43.549+0000",
"status": 500,
"error": "Internal Server Error",
"message": "Invalid JSON input. Position: 9. Character: '.'.",
"path": "/hotels/address/city/rome"
}
and the following log in console:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.bson.json.JsonParseException: Invalid JSON input. Position: 9. Character: '.'.] with root cause
org.bson.json.JsonParseException: Invalid JSON input. Position: 9. Character: '.'.
I don't know why I am getting Invalid JSON input. Position: 9. Character: '.'. when I am performing GET request?
Where am I going wrong?
Missing quotes; #Query(value = "{'address.country':?0}")
– Neil Lunn
That worked for me too.
It can arise if you are missing quotes or it can be due to unparsed string passed to MongoDB. Try using parsed string like \"appname\":1. This is an example of projection.

How to set null to field in graphql?

We use graphql on our project and use graphql-java 2.3.0 (we plan to update but it is not possible at the moment).
I'm trying to perform such mutation:
mutation {
UPDATE_User(
id:3,
type: null
) {id}
}
Response:
{
"errors": [
{
"validationErrorType": "WrongType",
"message": "Validation error of type WrongType: argument value EnumValue{name='null'} has wrong type",
"locations": [
{
"line": 5,
"column": 7
}
],
"errorType": "ValidationError"
}
],
"data": null
}
Null keyword is a relatively new addition to the GraphQL spec, and the graphql-java version you're using doesn't yet have it implemented. In fact, even 3.0.0 still doesn't have it. The soon-to-be-released 4.0 will have support for the null keyword.
And the reason it is treated as an enum is because unquoted strings are normally enums, null being the only exception. This is also explained in this issue.
In your schema, is 'type' parameter required ?
If not then simply omit it ! On your backend when you will retrieve the value of typethen it will be null

Random InternalServerError in ElasticSearch

We're keeping getting the following error randomly on random query in ElasticSearch.
{
\"status\":500,
\"displayName\":\"InternalServerError\",
\"message\":\"JsonParseException[Unrecognized token 'ards': was expecting ('true', 'false' or 'null')\n at [Source: [B#4103c9af; line: 1, column: 38]]\",
\"body\":{
\"error\":\"JsonParseException[Unrecognized token 'ards': was expecting ('true', 'false' or 'null')\n at [Source: [B#4103c9af; line: 1, column: 38]]\",\"status\":500
}
}
It even happen when we run a very simple query e.g.
{
"from":0,
"size":9,
"query":{
"terms":{
"id": [496161,496895,500119,544238,547116,547302,547364,633486,657141]
}
}
}
BTW, the same query without one of the ids passes without an error.
Seems to be the same issue as in the link bellow, the cause is you have indexed a first document with ... as a boolean.
https://discuss.elastic.co/t/reason-unrecognized-token-john-was-expecting-true-false-or-null/29700
You might want to check the actual mapping at <host>:<port>/<index>/<type>/_mapping.
Somewhere you should use a bool or select as null but you are inserting ards there
Search your queries for ards and replace it with a bool statement

update document in elasticsearch

I am using Elasticsearch by Restclient in Firefox adds-on
and I have the following problem when updating a document
{
"error": "JsonParseException[Unexpected character (':' (code 58)): was expecting comma to separate OBJECT entries
at [Source: [B#142d626; line: 3, column: 12]]",
"status": 500
}
and i do this
method : post
url: http://localhost:9200/test2/t2/2/_update?pretty
in body
{ "doc" :
"name":"oooooo"
}
any help
thanks
Try with the following JSON in your body:
{
"doc": {
"name": "oooooo"
}
}
In order to do a partial update, the JSON in the body must have a single doc field which contains the fields to update, in this case "name": "oooooo". In your case, you were simply missing the curly braces around the name field.

Resources