Open Mehdi-HAFID opened 1 year ago
Hello
According to the Korean translator's explanation, using the latest version of MongoDB, there was an error, and when using version 5.0, there was no error.
I also tried running it in a MongoDB 5.0.26
environment, and confirmed that the test code passes.
root@mongodb_docker_host:/# mongo --version
MongoDB shell version v5.0.26
Build Info: {
"version": "5.0.26",
...
To resolve class access exceptions to modules not registered as unnamed modules, and file encoding warnings (my Windows Terminal Encoding: MS949), I also added the following to the pom.xml
Exception for class access to modules not registered as unnamed modules
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @20322d26
...
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<includes>
<include>**/*.java</include>
</includes>
<argLine>
--add-opens java.base/java.lang=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
File encoding warnings
[WARNING] File encoding has not been set, using platform encoding MS949, i.e. build is platform dependent!
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Result: mvn clean test
have a nice day. 👍
I think the more specific cause is that the mongo-java-driver version used by hibernate-ogm-mongodb:4.2.0.Final is old.
When I try to run the test class HibernateOGMTest I get for mongodb
one of the warning says
WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
error out here
entityManagerFactory = Persistence.createEntityManagerFactory("ch18.hibernate_ogm");
persistence.xml & pom.xml are exact match as the source code so no typo there.
But when I changed to using neo4j instead of mongodb there is no error anymore and the tests pass. can anyone confirm that the issue exists for them too?