Closed neumannm closed 2 years ago
I'm experiencing the same exception using JDK 17 LTS
+1
Any status on this since JDK 17 is now a LTS ? This actually block the upgrade to new the JDK 17 LTS on our project 😢
Thanks again for your help.
Thomas
@neumannm As a workaround you could try a java opts: --add-opens java.base/java.lang=ALL-UNNAMED
@neumannm As a workaround you could try a java opts:
--add-opens java.base/java.lang=ALL-UNNAMED
It works indeed. But on my side I haven't been able to get it working within my maven configuration (args in pom.xml or in jvm.config)
I setup it as args to surefire and failsafe maven plugins.
I setup it as args to surefire and failsafe maven plugins.
Could you share this config section please? Thanks for your help
@thomaschampagne try this:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
--add-opens java.base/java.lang=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
@Saljack Thanks it works perfectly
Looks like you are doing this to get the PID of the process? Java 9 + have a method for this, so would sniffing for the method and using it if available avoid this error? I think you can sniff for the method and invoke without getting the wrath of JEP 403?
with the current release (3.2.0) it should work with java17 .. @mikebell90 i have to change this so that for everything after java 9 this method should be used.. the 3.0.0 release stopped at java15
@michaelmosmann Thank you for fixing this!
Last problem with this issue: if using Spring Boot, since 3.2.0, the autoconfiguration bean does'nt work anymore (new ProcessOutput
doesn't exist)
We have to replace ProcessOutput processOutput = new ProcessOutput(Processors.logTo(logger, Slf4jLevel.INFO), Processors.logTo(logger, Slf4jLevel.ERROR), Processors.named("[console>]", Processors.logTo(logger, Slf4jLevel.DEBUG)));
With:
ProcessOutput processOutput = ProcessOutput.builder()
.output(Processors.logTo(logger, Slf4jLevel.INFO))
.error(Processors.logTo(logger, Slf4jLevel.ERROR))
.commands(Processors.named("[console>]", Processors.logTo(logger, Slf4jLevel.DEBUG)))
.build();
add-opens java.base/java.lang=ALL-UNNAMED
What exactly this line of code means, as i faced the issue during the selenium java automation, so wanted to know what exactly this line indicated
@C5324260 try google? e.g. https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-12F945EB-71D6-46AF-8C3D-D354FD0B1781
I still have this issue on JDK 17 can you help me with the updated plugin or so ? Thanks!
@ManeaAlex23 which spring version/plugin version are you using?
@ManeaAlex23 still an issue?
Good night to all, I'm trying to use this plugin for integration tests on project with:
App works fine but we will launch mvn test for integration tests before to push on GCP Artifact Registry component by JIB and pipeline from Git.
I need MongoDB LTS version: 7.0.0 but I see that this plugin of MongoDB in memory start with 3..02
I added in pom.xml:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
--add-opens java.base/java.lang=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
to solve errors described here; but I suppose the plugin can't find imports json file path from test/resources... I imaged that I must specify filename *.json in test/resources or not? Please tell me some info about this path file:
<import>
<database>my-database</database>
<collection>myCollection</collection>
<file>my-database.myCollection.json</file>
<upsertOnImport>true</upsertOnImport>
<dropOnImport>true</dropOnImport>
<timeout>20000</timeout>
</import>
I got below errors in maven test with Maven DEBUG enabled:
Build ArtifactStore(useCache: true) Build ArtifactStore(useCache: true) cache NOT found for PRODUCTION:Windows:B64 Extract C:\Users*.embedmongo\win32\mongodb-win32-x86_64-3.0.2.zip START Extract C:\Users*.embedmongo\win32\mongodb-win32-x86_64-3.0.2.zip DONE Not Cached 1 de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet@3d4542d7 java.lang.reflect.InaccessibleObjectException: Unable to make field private final long java.lang.ProcessImpl.handle accessible: module java.base does not "opens java.lang" to unnamed module @f4c9be6 at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:391) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:367) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:315) at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:183) at java.base/java.lang.reflect.Field.setAccessible(Field.java:177) at de.flapdoodle.embed.process.runtime.Processes.windowsProcessId(Processes.java:110) ..... [mongod output]note: noprealloc may hurt performance in many applications [mongod output] 2024-07-13T00:27:13.397+0200 I CONTROL [initandlisten] MongoDB starting : pid=15528 port=27017 dbpath=C:\Users*\AppData\Local\Temp\embedmongo-db-a09b6c8c-ac83-43f4-ab7b-162708ea73f1 64-bit host=*** [mongod output] 2024-07-13T00:27:13.397+0200 I CONTROL [initandlisten] targetMinOS: Windows Server 2003 SP2 [mongod output] 2024-07-13T00:27:13.397+0200 I CONTROL [initandlisten] db version v3.0.2 I need LTS version 7.0.0!!!* [mongod output] 2024-07-13T00:27:13.397+0200 I CONTROL [initandlisten] git version: 6201872043ecbbc0a4cc169b5482dcf385fc464f [mongod output] 2024-07-13T00:27:13.397+0200 I CONTROL [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49 [mongod output] 2024-07-13T00:27:13.397+0200 I CONTROL [initandlisten] allocator: system [mongod output] 2024-07-13T00:27:13.397+0200 I CONTROL [initandlisten] options: { net: { http: { enabled: false }, port: 27017 }, security: { authorization: "disabled" }, storage: { dbPath: "C:\Users\\AppData\Local\Temp\embedmongo-db-a09b6c8c-ac83-43f4-ab7b-162708ea73f1", journal: { enabled: false }, mmapv1: { preallocDataFiles: false, smallFiles: true } } } [mongod output] 2024-07-13T00:27:13.398+0200 I INDEX [initandlisten] allocating new ns file C:\Users*\AppData\Local\Temp\embedmongo-db-a09b6c8c-ac83-43f4-ab7b-162708ea73f1\local.ns, filling with zeroes... [mongod output] 2024-07-13T00:27:13.414+0200 I STORAGE [FileAllocator] allocating new datafile C:\Users*\AppData\Local\Temp\embedmongo-db-a09b6c8c-ac83-43f4-ab7b-162708ea73f1\local.0, filling with zeroes... [mongod output] 2024-07-13T00:27:13.414+0200 I STORAGE [FileAllocator] creating directory C:\Users*\AppData\Local\Temp\embedmongo-db-a09b6c8c-ac83-43f4-ab7b-162708ea73f1_tmp [mongod output] 2024-07-13T00:27:13.415+0200 I STORAGE [FileAllocator] done allocating datafile C:\Users*\AppData\Local\Temp\embedmongo-db-a09b6c8c-ac83-43f4-ab7b-162708ea73f1\local.0, size: 16MB, took 0 secs [mongod output] 2024-07-13T00:27:13.420+0200 I NETWORK [initandlisten] waiting for connections on port 27017 [mongod output] INFO start de.flapdoodle.embed.mongo.config.MongodConfigBuilder$ImmutableMongodConfig@5ec7d385 Default import database: my-database Import ImportDataConfig{database='my-database', collection='myCollection', file='my-database.myCollection.json', dropOnImport=true, upsertOnImport=true, timeout=20000} Build ArtifactStore(useCache: true) cache NOT found for PRODUCTION:Windows:B64 Extract C:\Users*.embedmongo\win32\mongodb-win32-x86_64-3.0.2.zip START Extract C:\Users*.embedmongo\win32\mongodb-win32-x86_64-3.0.2.zip DONE DEBUG Not Cached 1 de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet@493c0ba8 java.lang.reflect.InaccessibleObjectException: Unable to make field private final long java.lang.ProcessImpl.handle accessible: module java.base does not "opens java.lang" to unnamed module @f4c9be6 at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:391) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:367) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:315) at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:183) at java.base/java.lang.reflect.Field.setAccessible(Field.java:177) at de.flapdoodle.embed.process.runtime.Processes.windowsProcessId(Processes.java:110) at de.flapdoodle.embed.process.runtime.Processes.access$200(Processes.java:51) at de.flapdoodle.embed.process.runtime.Processes$PidHelper$2.getPid(Processes.java:209) at de.flapdoodle.embed.process.runtime.Processes.processId(Processes.java:72)
Thanks a lot for your supports!
Adding in plugin resources to load file don't solve:
<configuration>
<resources>
<resource>
<directory>${basedir}/src/test/java/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
...
</configuration>```
I tried to set version 7.0.0 but https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-7.0.0.zip reply Access denied so can't download zip file to install correct version of MongoDB 7.0.0 usefull for me :(
<executions>
<execution>
<configuration>
<version>7.0.0</version>
...
</execution>
....
</executions>
For mongoDB LTS 7.0.0 the path to download is https://fastdl.mongodb.org/windows/mongodb-windows-x86_64-7.0.0.zip and NOT http://fastdl.mongodb.org/win32/mongodb-win32-x86_64-7.0.0.zip. Please fix it.
@skyblackhawk you are using an outdated version.. there is no way to fix this with this old version
Spring Boot mongodb version: 2.5.3 flapdoodle version: 3.0.0 JDK 16
I noticed the following exception on application startup when running my unit tests with the embedded mongodb:
This exception does not seem to have any significant impact since the application continues to start and the tests run fine, but I am wondering where it comes from and how I can get rid of it?