mxsm opened a new issue, #4161:
URL: https://github.com/apache/eventmesh/issues/4161

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Environment
   
   Windows
   
   ### EventMesh version
   
   master
   
   ### What happened
   
   ```
   final Map<String, Object> content = new HashMap<>();
   content.put("content", "testAsyncMessage");
    content.put("content", LocalDate.now());
   
   JsonUtils.toJSONString(content)
   ```
   throw exception
   
   
   ### How to reproduce
   
   ```
   final Map<String, Object> content = new HashMap<>();
   content.put("content", "testAsyncMessage");
    content.put("content", LocalDate.now());
   
   JsonUtils.toJSONString(content)
   ```
   
   ### Debug logs
   
   ```
   Exception in thread "main" 
org.apache.eventmesh.common.exception.JsonException: serialize to json error
        at 
org.apache.eventmesh.common.utils.JsonUtils.toJSONString(JsonUtils.java:66)
        at 
org.apache.eventmesh.grpc.GrpcAbstractDemo.buildEventMeshMessage(GrpcAbstractDemo.java:71)
        at 
org.apache.eventmesh.grpc.pub.eventmeshmessage.AsyncPublishInstance.main(AsyncPublishInstance.java:49)
   Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: 
Java 8 date/time type `java.time.LocalDate` not supported by default: add 
Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable 
handling (through reference chain: java.util.HashMap["content"])
        at 
com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:77)
        at 
com.fasterxml.jackson.databind.SerializerProvider.reportBadDefinition(SerializerProvider.java:1300)
        at 
com.fasterxml.jackson.databind.ser.impl.UnsupportedTypeSerializer.serialize(UnsupportedTypeSerializer.java:35)
        at 
com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeOptionalFields(MapSerializer.java:869)
        at 
com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeWithoutTypeInfo(MapSerializer.java:760)
        at 
com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:720)
        at 
com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:35)
        at 
com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480)
        at 
com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:319)
        at 
com.fasterxml.jackson.databind.ObjectMapper._writeValueAndClose(ObjectMapper.java:4569)
        at 
com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3822)
        at 
org.apache.eventmesh.common.utils.JsonUtils.toJSONString(JsonUtils.java:64)
        ... 2 more
   ```
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to