How to solve Json Parse exception: Invalid date format

How to solve Json Parse exception: Invalid date format

book

Article ID: KB0079835

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for MongoDB -

Description

The MongoDB BW Plugin InsertDocument activity threw the exception below that indicated the input date value format is not correct at runtime,

 

org.bson.json.JsonParseException: Invalid date format.

 at org.bson.json.JsonReader.visitISODateTimeConstructor(JsonReader.java:819)

 at org.bson.json.JsonReader.readBsonType(JsonReader.java:200)

 at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:149)

 at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:45)

 at org.bson.Document.parse(Document.java:105)

 at org.bson.Document.parse(Document.java:90)

 at com.tibco.bw.palette.mongodb.runtime.InsertDocumentAsynchronousActivity.executeInsert(InsertDocumentAsynchronousActivity.java:154)

 at com.tibco.bw.palette.mongodb.runtime.InsertDocumentAsynchronousActivity.access$1(InsertDocumentAsynchronousActivity.java:118)

 at 

 

The root cause of the error thrown while invoking the MongoDB Java driver APIs for handling the ISODateTime is that the constructed DateTime value contains blank character before or after timezone offset, particularly using XPath function definition that introduces the extra character and resulted in the runtime error. 

 

 

Environment

Product: TIBCO ActiveMatrix BusinessWorks Plug-in for MongoDB Version: 6.2.0 OS: All Supported Operating Systems

Resolution

To solve the issue, please ensure in all the cases of the input value complies with the format of MongoDB Java driver API. 

Issue/Introduction

How-to-solve-Json-Parse-exception-Invalid-date-format