kmongo
kmongo copied to clipboard
IllegalAccessError: tried to access method org.bson.internal.OverridableUuidRepresentationCodecRegistry
Whenever I run my application I get this error:
java.lang.IllegalAccessError: tried to access method org.bson.internal.OverridableUuidRepresentationCodecRegistry.
dependencies {
implementation 'org.litote.kmongo:kmongo-serialization:4.6.1'
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3"
implementation 'org.mongodb:bson:4.7.1'
}
and I run shadowJar
Here is my implementation (It errors when I call this)
lateinit var client: MongoClientSettings
lateinit var mongoClient: MongoClient
lateinit var database: MongoDatabase
fun load() {
client = MongoClientSettings.builder()
.applyConnectionString(ConnectionString("my mongoDb URL"))
.uuidRepresentation(UuidRepresentation.STANDARD)
.build()
mongoClient = KMongo.createClient(client)
database = mongoClient.getDatabase("Influx")
}
Specifically on the line where I initialize mongoClient.
This is caused by the protocol in the ihcf event causing an abstract class to throw an java exception handler
First idea: try to use org.litote.kmongo:kmongo-serialization:4.7.0.
Because org.litote.kmongo:kmongo-serialization:4.6.1 is compiled with org.mongodb:bson:4.6.0 (and not 4.7.1)
HTH
First idea: try to use org.litote.kmongo:kmongo-serialization:4.7.0.
Because org.litote.kmongo:kmongo-serialization:4.6.1 is compiled with org.mongodb:bson:4.6.0 (and not 4.7.1)
HTH
Sorry for the late reply.
Still seems to throw the exact same error!
Check if you have other version of mongo jar in your dependencies (from third party dependencies). Usually this is the origin of this stacktrace
HTH