jmxterm icon indicating copy to clipboard operation
jmxterm copied to clipboard

error opening local connection

Open alxgomz opened this issue 6 years ago • 3 comments

I'm trying to open a connection to a local java process using the open PID command. Whe doing so I have the follwoin g exception (in verbose mode):

Welcome to JMX terminal. Type "help" for available commands.
$>open 1933
java.lang.UnsupportedOperationException: Operation requires JDK instead of JRE
        at org.cyclopsgroup.jmxterm.pm.UnsupportedJavaProcessManager.get(UnsupportedJavaProcessManager.java:54)                                                                               
        at org.cyclopsgroup.jmxterm.SyntaxUtils.getUrl(SyntaxUtils.java:59)
        at org.cyclopsgroup.jmxterm.cmd.OpenCommand.execute(OpenCommand.java:73)
        at org.cyclopsgroup.jmxterm.cc.CommandCenter.doExecute(CommandCenter.java:188)
        at org.cyclopsgroup.jmxterm.cc.CommandCenter.doExecute(CommandCenter.java:158)
        at org.cyclopsgroup.jmxterm.cc.CommandCenter.execute(CommandCenter.java:206)
        at org.cyclopsgroup.jmxterm.boot.CliMain.execute(CliMain.java:176)
        at org.cyclopsgroup.jmxterm.boot.CliMain.main(CliMain.java:50)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                                                              
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:353)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:264)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                                                              
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.classworlds.uberjar.boot.Bootstrapper.bootstrap(Bootstrapper.java:209)
        at org.codehaus.classworlds.uberjar.boot.Bootstrapper.main(Bootstrapper.java:116)
Caused by: java.lang.RuntimeException: Operation requires JDK instead of JRE
        at org.cyclopsgroup.jmxterm.pm.JConsoleClassLoaderFactory.getClassLoader(JConsoleClassLoaderFactory.java:42)                                                                          
        at org.cyclopsgroup.jmxterm.cc.JPMFactory.<init>(JPMFactory.java:34)
        at org.cyclopsgroup.jmxterm.cc.CommandCenter.<init>(CommandCenter.java:87)
        at org.cyclopsgroup.jmxterm.cc.CommandCenter.<init>(CommandCenter.java:71)
        at org.cyclopsgroup.jmxterm.boot.CliMain.execute(CliMain.java:136)
        ... 15 more

The java environment is indeed a JRE and not a JDK however, checking the code the strack tracepoints to I don't understand why I'm getting this error. JConsoleClassLoaderFactory.java tests for java.io.File.isFile('lib/tools.jar') and should only throw this RuntimeException in case it this file is not a file.

I have started jmxterm setting the JAVA_HOME env to the directory containing lib/ and even tried starting it with java installation being the PWD as well...

Why am I getting this exception and is the JDK really needed in order to open a local process?

alxgomz avatar Apr 15 '19 15:04 alxgomz

I forgot to mention it but I of course have tools.jar and jconsole.jar within the lib directory of my java installation. And sorry if this is not the right place to post that but I couldn't find another place

alxgomz avatar Apr 15 '19 15:04 alxgomz

A similar issue with 1.0.1

$>open 2813
#UnsupportedOperationException: /usr/lib/jvm/java-8-openjdk-amd64/lib/jconsole.jar file is not found

Problem is jconsole.jar is not included in the headless JDK, because it requires a GUI.

OrangeDog avatar Aug 06 '19 14:08 OrangeDog

I htink this is fixed by downloading the -uber.jar. Did you try that?

StyXman avatar Mar 21 '24 13:03 StyXman