Bug Report: Cannot run scan
Closed this issue · 6 comments
Bug Description
When running bin\jqassistant.cmd scan -f lib in jqassistant-commandline-distribution-2.0.10, I get Exception in thread "main" java.lang.LinkageError: Cannot to link java.nio.DirectByteBuffer, caused by java.lang.IllegalAccessException: module java.base does not open java.nio to unnamed module @184cf7cf. This and a similar problem can be mitigated by adding the arguments --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED to the java command in jqassistant.cmd, but then I get java.io.IOException: java.lang.UnsupportedOperationException caused by java.lang.UnsupportedOperationException.
Expected Behaviour
There should be no exception.
Your Environment
- JDK: 21
java version "21.0.1" 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 21.0.1+12-LTS-29)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.1+12-LTS-29, mixed mode, sharing) - OS: Windows 10 Pro
Version: 22H2
OS build: 9045.4412
Experience: Windows Feature Experience Pack 1000.19056.1000.0
How can we reproduce the bug?
Run bin\jqassistant.cmd scan -f lib in jqassistant-commandline-distribution-2.0.10 with JDK 21.
This issue has been solved in jQA 2.1.x, please use the latest Neo4j v5 distribution (see https://jqassistant.github.io/jqassistant/doc/2.1.0/#_command_line).
The M2 central UI has room for improvements… Seems that it’s easier to click on „View All“ beside latest version and then „Browse“ for the version of interest. This takes you to a directory view containing all files. From there you can download the ZIP distribution.
Yes, thanks, I had just found it and deleted my other comments. This is what I just had typed concurrently to you:
Thanks. It was very hard to find. The quick start links to the wrong package - the one where 2.0.10 is the latest version. Both quick start and the manual you linked ask the user to download a zip file "from the Download menu". This is misleading, as there is no download menu on the site. Instead, it should read Download the *-distribution.zip file from Versions | Browse. Also, on https://jqassistant.github.io/jqassistant/doc/2.1.0/#_command_line, the link text should not be JDK 11 / JDK 17 or later, but be prefixed with jQAssistant for.
The quickstart section of the manual has been updated: jqassistant-archive/jqa-manual@621331c
This issue has been solved in jQA 2.1.x, please use the latest Neo4j v5 distribution (see https://jqassistant.github.io/jqassistant/doc/2.1.0/#_command_line).
I have just tried to run jQAssistant 2.3.1 (jqassistant-commandline-neo4jv4-2.3.1-distribution.zip) as described in the quickstart of the user manual:
./bin/jqassistant.sh scan -f libThis lead to the following error message:
2024-07-10 06:12:56.499 [main] INFO StoreFactory - Connecting to store at file:/path/to/jqassistant-commandline-neo4jv4-2.3.1/jqassistant/store'
Exception in thread "main" java.lang.LinkageError: Cannot to link java.nio.DirectByteBuffer
at org.neo4j.internal.unsafe.UnsafeUtil.<clinit>(UnsafeUtil.java:128)
at org.neo4j.memory.RuntimeInternals.guessHeaderSize(RuntimeInternals.java:158)
at org.neo4j.memory.RuntimeInternals.<clinit>(RuntimeInternals.java:53)
at org.neo4j.memory.HeapEstimator.<clinit>(HeapEstimator.java:103)
at org.neo4j.internal.collector.RecentQueryBuffer.<clinit>(RecentQueryBuffer.java:37)
at org.neo4j.graphdb.factory.module.GlobalModule.<init>(GlobalModule.java:212)
at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.createGlobalModule(DatabaseManagementServiceFactory.java:272)
at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.build(DatabaseManagementServiceFactory.java:133)
at org.neo4j.dbms.api.DatabaseManagementServiceBuilder.newDatabaseManagementService(DatabaseManagementServiceBuilder.java:101)
at org.neo4j.dbms.api.DatabaseManagementServiceBuilder.build(DatabaseManagementServiceBuilder.java:94)
at com.buschmais.xo.neo4j.embedded.api.FileDatabaseManagementServiceFactory.createDatabaseManagementService(FileDatabaseManagementServiceFactory.java:39)
at com.buschmais.xo.neo4j.embedded.api.EmbeddedNeo4jXOProvider.createDatastore(EmbeddedNeo4jXOProvider.java:49)
at com.buschmais.xo.impl.XOManagerFactoryImpl.<init>(XOManagerFactoryImpl.java:48)
at com.buschmais.xo.impl.bootstrap.XOBootstrapServiceImpl.createXOManagerFactory(XOBootstrapServiceImpl.java:41)
at com.buschmais.xo.api.bootstrap.XO.createXOManagerFactory(XO.java:48)
at com.buschmais.jqassistant.core.store.impl.AbstractGraphStore.start(AbstractGraphStore.java:71)
at com.buschmais.jqassistant.commandline.task.AbstractStoreTask.withStore(AbstractStoreTask.java:49)
at com.buschmais.jqassistant.commandline.task.ScanTask.run(ScanTask.java:51)
at com.buschmais.jqassistant.commandline.Main.executeTask(Main.java:320)
at com.buschmais.jqassistant.commandline.Main.executeTasks(Main.java:278)
at com.buschmais.jqassistant.commandline.Main.interpretCommandLine(Main.java:204)
at com.buschmais.jqassistant.commandline.Main.run(Main.java:82)
at com.buschmais.jqassistant.commandline.Main.main(Main.java:63)
Caused by: java.lang.IllegalAccessException: module java.base does not open java.nio to unnamed module @4ca1042e
at java.base/java.lang.invoke.MethodHandles.privateLookupIn(MethodHandles.java:259)
at org.neo4j.internal.unsafe.UnsafeUtil.<clinit>(UnsafeUtil.java:111)
... 22 more
Here is the environment:
$ java --version
openjdk 17.0.7 2023-04-18
OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7)
OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, sharing)
$ sw_vers
ProductName: macOS
ProductVersion: 12.7.5
BuildVersion: 21H1222
After downgrading to Java 11, the error does not occur anymore:
sdk install java 11.0.23-tem
sdk use java 11.0.23-temThere will be a warning about illegal reflective access, though:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access using Lookup on org.neo4j.internal.unsafe.UnsafeUtil (file:/path/to/jqassistant-commandline-neo4jv4-2.3.1/lib/org.neo4j-neo4j-unsafe-4.4.34.jar) to class java.nio.Buffer
WARNING: Please consider reporting this to the maintainers of org.neo4j.internal.unsafe.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
The problem was caused by a typo in the user manual: