MongoDB PojoCodecDriver Error Registering 3rd party Package Class

28 views Asked by At

I have an issue registering POJO classes from 3rd party libraries in my project with MongoDB so that I can use the POJOS.

I'm registering the classes first as follows:

  PojoCodecProvider pojoCodecProvider = PojoCodecProvider.builder()
.register("com.myproject.classpackage")
.register("com.thirdpartyproject.classpackage3")
.register("com.myproject.classpackage2")

Classes from my project whose registrations come before and after the third party project classes are working just fine. However, registering the third-party package does not work and I always get an error: "no code found for class X under package com.thirdpartyproject.classpackage3"

If it makes any difference I'm using gradle and the third-party package is added to the project like this:

    implementation files('files/thirdpartylibrary.jar')

Other than the issue with the MongoDB POJO driver, I can use the third-party library just fine. I was thinking of storing them as a JSON object using GSON and some custom wrappers.

The third-party library POJOs may change over time and I'd rather not implement my own classes just to store the data in MongoDB. Any help would be much appreciated.

0

There are 0 answers