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

Add documentation about connecting to JVMs #33

Closed
gquintana opened this issue Jun 13, 2018 · 3 comments
Closed

Add documentation about connecting to JVMs #33

gquintana opened this issue Jun 13, 2018 · 3 comments

Comments

@gquintana
Copy link
Contributor

As a newcomer, I wish I had read some advice to troubleshoot connection between sjk and my app:

$ java -jar sjk.jar ttop -p <pid>
Failed to access MBean server: <pid>
  • Always use the same user to run sjk as the application: sudo -u elasticsearch java -jar sjk.jar ttop -p <elasticsearch pid> and test the connection with jstack before using sjk
  • Disable firewalls (iptables and the like): even if you're connecting locally using a PID, sockets are still used for communication.

This would have saved me hours of investigation.

@aragozin
Copy link
Owner

Good point!

I can recall one more reason. Target JVM may have -Dtmp.io.dir pointing to non-defalt location.

I would extend error message.

@eugeniyk
Copy link

@aragozin you can also add JDK installed as prerequisite since with JRE it can't attach

Java home points to /usr/java/jre1.8.0_66 make sure it is not a JRE path
Failed to add tools.jar to classpath
java.lang.ClassNotFoundException: com.sun.tools.attach.VirtualMachine
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at org.gridkit.lab.jvm.attach.AttachAPI.<clinit>(AttachAPI.java:45)
	at org.gridkit.lab.jvm.attach.AttachManager.<clinit>(AttachManager.java:73)
	at org.gridkit.jvmtool.JmxConnectionInfo.getMServer(JmxConnectionInfo.java:72)
	at org.gridkit.jvmtool.cmd.GcRepCmd$GcRep.run(GcRepCmd.java:63)
	at org.gridkit.jvmtool.cli.CommandLauncher.start(CommandLauncher.java:133)
	at org.gridkit.jvmtool.SJK.main(SJK.java:11)

@aragozin
Copy link
Owner

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

3 participants