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

Broken on JDK7 #1

Open
vladimirvivien opened this issue Mar 19, 2012 · 16 comments
Open

Broken on JDK7 #1

vladimirvivien opened this issue Mar 19, 2012 · 16 comments

Comments

@vladimirvivien
Copy link
Owner

When running on JDK7, several commands (including ps and connect) cause the following error:

Exception in thread "Thread-2" java.lang.NoClassDefFoundError: sun/jvmstat/monitor/HostIdentifier
    at org.clamshellcli.jmx.Management.getHostIdentifier(Management.java:83)
    at org.clamshellcli.jmx.Management.mapVmInfo(Management.java:113)
    at org.clamshellcli.jmx.PsCommand.execute(PsCommand.java:88)
    at org.clamshellcli.jmx.JmxController.handle(JmxController.java:81)
    at org.clamshellcli.impl.CliConsole$1.run(CliConsole.java:150)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: sun.jvmstat.monitor.HostIdentifier
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 6 more
@cswingler
Copy link

Oddly enough, I'm seeing the same issue on 1.6.0_39 x86_64:

[root@worker1 jmxcli-0.1.2]# java -jar cli.jar 

Java version: 1.6.0_39
OS: Linux, Version: 2.6.32-279.19.1.el6.x86_64
jmx-cli > ps
Exception in thread "Thread-2" java.lang.NoClassDefFoundError: sun/jvmstat/monitor/HostIdentifier
    at org.clamshellcli.jmx.Management.getHostIdentifier(Management.java:83)
    at org.clamshellcli.jmx.Management.mapVmInfo(Management.java:113)
    at org.clamshellcli.jmx.PsCommand.execute(PsCommand.java:88)
    at org.clamshellcli.jmx.JmxController.handle(JmxController.java:81)
    at org.clamshellcli.impl.CliConsole$1.run(CliConsole.java:150)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: sun.jvmstat.monitor.HostIdentifier
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 6 more

@vladimirvivien
Copy link
Owner Author

Thanks for reporting. This is on track to be fixed in the next release.

@unhuman
Copy link

unhuman commented Mar 29, 2013

Any update on this? Busted for me.

@galmeida
Copy link

galmeida commented Apr 3, 2013

Any workarounds?

$ java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode, sharing)

@vladimirvivien
Copy link
Owner Author

Guys sorry for delay. Looking at this to have a fix soon.

@unhuman
Copy link

unhuman commented Apr 3, 2013

I'm currently using JMXTerm:
http://wiki.cyclopsgroup.org/jmxterm

@ronaldborman
Copy link

I also saw the same error on 1.6.0_24-b07. It looks like a tools.jar issue. As a workaround I added the full path of tools.jar (only included in a jdk and not in a jre?) to the Class-Path entry of MANIFEST.MF in cli.jar. That works but is no more than a quick unpractical hack.

Somehow you have to add tools.jar to the classpath without editing MANIFEST.MF. But including -cp or setting the classpath environment variable don't seem to work.

@8forty
Copy link

8forty commented Oct 3, 2013

Same problem here, going with JMXTerm

@tekumara
Copy link

tekumara commented Dec 8, 2013

Same problem here on Mac OS X JDK 1.7.0_45 :(

@stentrup
Copy link

It works when I copy the tools.jar from the JDK's lib directory into the lib directory of jmx-cli

@xrl
Copy link

xrl commented Jun 17, 2016

I think this has to be run inside a JDK environment. I am successfully running this project inside of the docker image java:openjdk-8-jdk.

docker run --rm -it java:openjdk-8-jdk
wget https://github.com/downloads/vladimirvivien/jmx-cli/jmxcli-0.1.2-bin.zip
unzip jmxcli-0.1.2-bin.zip && cd jmxcli-0.1.2
cp $(find / -name tools.jar) lib/
java -jar cli.jar


    /#####                                /######    /##   /##
   |__  ##                               /##__  ##  | ##  |__/
      | ##   /######/####    /##   /##  | ##  \__/  | ##   /##
      | ##  | ##_  ##_  ##  |  ## /##/  | ##        | ##  | ##
 /##  | ##  | ## \ ## \ ##   \  ####/   | ##        | ##  | ##
| ##  | ##  | ## | ## | ##    >##  ##   | ##    ##  | ##  | ##
|  ######/  | ## | ## | ##   /##/\  ##  |  ######/  | ##  | ##
 \______/   |__/ |__/ |__/  |__/  \__/   \______/   |__/  |__/

A command-line tool for JMX
Powered by Clamshell-Cli framework
http://code.google.com/p/clamshell-cli/

Java version: 1.8.0_91
OS: Linux, Version: 4.4.11-moby

@vladimirvivien
Copy link
Owner Author

@xrl Awesome!!!!!

@JensRantil
Copy link

@xrl I understand it was a while ago you made your comment, but do you also remember if you verified commands such as ps worked as expected? Just like in the issue description, I can start the application, but ps doesn't work.

@vladimirvivien
Copy link
Owner Author

@JensRantil I am not actively maintaining this project. ps should work ok.

@voiprodrigo
Copy link

voiprodrigo commented Mar 9, 2018

ps and connect do not seem to work, they hang. I'm running openjdk in a CentOS7 system. I copied the tools.jar from the JRE to the lib/ dir, otherwise it would give exception

Java version: 1.8.0_141
OS: Linux, Version: 3.10.0-693.17.1.el7.x86_64
jmx-cli > connect pid:181247

Update: ps doesn't work, but I was able to use connect host:port and list Mbeans. Good enough for me!

@vladimirvivien
Copy link
Owner Author

@voiprodrigo awesome to know!!!

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

No branches or pull requests