Greetings, fellow OpenHAB enthusiasts! I’m reaching out to the community to seek some guidance on an issue I’ve encountered with MongoDB persistence in OpenHAB 3. As many of you might know, I recently migrated from MySQL to MongoDB, and while the transition seemed smooth at first, I’ve hit a bit of a snag.
The problem arises when I attempt to call the REST API endpoint for persistence. I consistently receive a 500 Internal Server Error with the message: ‘can’t serialize class java.time.ZonedDateTime’. This has halted my progress in setting up a reliable persistence layer, and I’m eager to resolve it.
I’ve tried several troubleshooting steps, including adjusting regional settings and ensuring all configurations are correctly set up. Despite these efforts, the issue persists. I’m wondering if anyone else has encountered this problem and, if so, how they managed to overcome it.
Here’s a snippet of the error log for reference:
java
java.lang.IllegalArgumentException: can’t serialize class java.time.ZonedDateTime
at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:299)
at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:194)
at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:255)
at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:194)
at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:136)
at com.mongodb.DefaultDBEncoder.writeObject(DefaultDBEncoder.java:36)
at com.mongodb.OutMessage.putObject(OutMessage.java:289)
at com.mongodb.OutMessage.writeQuery(OutMessage.java:211)
at com.mongodb.OutMessage.query(OutMessage.java:86)
at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:81)
at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:66)
at com.mongodb.DBCursor._check(DBCursor.java:498)
at com.mongodb.DBCursor._hasNext(DBCursor.java:621)
at com.mongodb.DBCursor.hasNext(DBCursor.java:657)
at org.openhab.persistence.mongodb.internal.MongoDBPersistenceService.query(MongoDBPersistenceService.java:293)
I’m curious if there’s a known workaround or if this is a recognized issue within the OpenHAB community. Any insights or suggestions would be greatly appreciated. Let’s collaborate to find a solution!
Best regards,
[Your Name]