jqassistant-archive / jqa-commandline-tool

http://jqassistant.org/
GNU General Public License v3.0
10 stars 3 forks source link

Bug Report: Cannot run scan #37

Closed marco-eckstein closed 4 months ago

marco-eckstein commented 5 months ago

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

How can we reproduce the bug?

Run bin\jqassistant.cmd scan -f lib in jqassistant-commandline-distribution-2.0.10 with JDK 21.

DirkMahler commented 4 months ago

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).

DirkMahler commented 4 months ago

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.

marco-eckstein commented 4 months ago

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.

DirkMahler commented 4 months ago

The quickstart section of the manual has been updated: https://github.com/jQAssistant/jqa-manual/commit/621331c2981bca9d13b654d05f993a6ccfdc34bf

jmewes commented 3 months ago

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 lib

This 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-tem

There 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
jmewes commented 3 months ago

The problem was caused by a typo in the user manual:

https://github.com/jQAssistant/jqa-manual/pull/26