Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not build or run with java9 #48

Open
git4skatz opened this issue Feb 9, 2018 · 4 comments · May be fixed by #113
Open

Does not build or run with java9 #48

git4skatz opened this issue Feb 9, 2018 · 4 comments · May be fixed by #113

Comments

@git4skatz
Copy link

Tried with Java9.0.4

Build time error:
[INFO] Running org.cyclopsgroup.jmxterm.pm.JConsoleClassLoaderFactoryTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.049 s <<< FAILURE! - in org.cyclopsgroup.jmxterm.pm.JConsoleClassLoaderFactoryTest
[ERROR] testLoad(org.cyclopsgroup.jmxterm.pm.JConsoleClassLoaderFactoryTest) Time elapsed: 0.012 s <<< ERROR!
java.lang.RuntimeException: Operation requires JDK instead of JRE
at org.cyclopsgroup.jmxterm.pm.JConsoleClassLoaderFactoryTest.testLoad(JConsoleClassLoaderFactoryTest.java:22)

Runtime error:
:~/Downloads$ java -jar jmxterm-1.0.0-uber.jar
java.lang.NullPointerException
at org.codehaus.classworlds.Launcher.getEnhancedMainMethod(Launcher.java:195)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:294)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.codehaus.classworlds.uberjar.boot.Bootstrapper.bootstrap(Bootstrapper.java:209)
at org.codehaus.classworlds.uberjar.boot.Bootstrapper.main(Bootstrapper.java:116)

@hyproman
Copy link

hyproman commented Jun 3, 2018

Same behavior on 10.0.1:

java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)

@jfharden
Copy link

jfharden commented Sep 15, 2019

And in 12, and 14ea:


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project jmxterm: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.: NullPointerException -> [Help 1]

...

bash-4.2# java -version
openjdk version "12.0.2" 2019-07-16
OpenJDK Runtime Environment (build 12.0.2+10)
OpenJDK 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)
bash-4.2# java -version
openjdk version "14-ea" 2020-03-17
OpenJDK Runtime Environment (build 14-ea+14-570)
OpenJDK 64-Bit Server VM (build 14-ea+14-570, mixed mode, sharing)

@SandroGrzicic
Copy link

SandroGrzicic commented Oct 2, 2019

After making a local build with upgraded dependencies, setting "source" and "target" of maven-compiler-plugin in the POM to "13", building on AdoptOpenJDK 13 works fine, and running it under the same JDK 13 works and the console can be used, however when trying to "open" (connect to) a process I get the following Unable to detect the run-time image error which I cannot resolve:

Listing available beans...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.cyclopsgroup.jmxterm.utils.WeakCastUtils$2 (file:jmxterm-1.0.1-uber.jar) to method sun.tools.jconsole.LocalVirtualMachine.getAllVirtualMachines()
WARNING: Please consider reporting this to the maintainers of org.cyclopsgroup.jmxterm.utils.WeakCastUtils$2
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
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
	at com.sun.proxy.$Proxy7.startManagementAgent(Unknown Source)
	at org.cyclopsgroup.jmxterm.jdk6.Jdk6JavaProcess.startManagementAgent(Jdk6JavaProcess.java:39)
	at org.cyclopsgroup.jmxterm.SyntaxUtils.getUrl(SyntaxUtils.java:51)
	at org.cyclopsgroup.jmxterm.boot.CliMain.execute(CliMain.java:127)
	at org.cyclopsgroup.jmxterm.boot.CliMain.main(CliMain.java:41)
Caused by: com.sun.tools.attach.AttachOperationFailedException: java.lang.InternalError: Unable to detect the run-time image
	at jdk.attach/sun.tools.attach.VirtualMachineImpl.execute(VirtualMachineImpl.java:224)
	at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.executeCommand(HotSpotVirtualMachine.java:309)
	at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.executeJCmd(HotSpotVirtualMachine.java:291)
	at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.startLocalManagementAgent(HotSpotVirtualMachine.java:250)
	at jdk.jconsole/sun.tools.jconsole.LocalVirtualMachine.loadManagementAgent(LocalVirtualMachine.java:237)
	at jdk.jconsole/sun.tools.jconsole.LocalVirtualMachine.startManagementAgent(LocalVirtualMachine.java:96)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.cyclopsgroup.jmxterm.utils.WeakCastUtils$1.invoke(WeakCastUtils.java:53)
	... 5 more

The error appears to come from here:

https://github.com/AdoptOpenJDK/openjdk-jdk/blob/master/src/java.base/share/classes/jdk/internal/module/SystemModuleFinders.java#L210

However, executing java.lang.module.ModuleFinder.ofSystem() (which calls SystemModuleFinders.ofSystem) in a separate Java program on the same JDK works fine.

Version:

openjdk version "13" 2019-09-17
OpenJDK Runtime Environment AdoptOpenJDK (build 13+33)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13+33, mixed mode, sharing)

@nyg
Copy link
Contributor

nyg commented Feb 3, 2024

If you want a quick fix, you can check this StackOverflow question and answers: https://stackoverflow.com/q/75239006.

However, using --add-exports means dropping support for Java 8 (unless jmxterm defines multiple build profiles) and more importantly can't be used with the new release option of javac (the jdk.jconsole module is not part of the public API).

@nyg nyg linked a pull request Feb 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants