javaubuntuneo4jvisualvmjstatd

remote profiling neo4j using visualvm


I am trying to monitor GC information using VisualVM from local laptop and connecting to Neo4j (enterprise) application running on Oracle JDK 8 on remote EC2 instance running ubuntu 16. I am able to connect using JMX connection but the issue is I can't view anything on VisualGC (plugin). The message is "Not supported for this JVM".

Based on this link and link, I ran the jstatd command on the remote but that didn't solve the problem. Next, looked at this link, I ran jstatd as neo4j user as this is the user under which Neo4j service runs. If I run jstatd as ubuntu user, the below command works but doesn't show any data on VisualGC.

sudo -u neo4j jstatd -p 8888 -J-Djava.security.policy=/home/ubuntu/tools.policy -J-Djava.rmi.server.hostname=neo4j_ip_address

Running above command as neo4j user gave this error:

Could not create remote object access denied ("java.util.PropertyPermission" "java.rmi.server.ignoreSubClasses" "write") java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.rmi.server.ignoreSubClasses" "write")
        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
        at java.security.AccessController.checkPermission(AccessController.java:884)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
        at java.lang.System.setProperty(System.java:792)
        at sun.tools.jstatd.Jstatd.main(Jstatd.java:139)

Are these the correct permissions for tools.policy file?

-rwxr-xr-x 1 neo4j  adm    112 Mar 21 15:41 tools.policy

Contents of tools.policy:

grant codebase "file:/usr/lib/jvm/java-8-oracle/lib/tools.jar" {
   permission java.security.AllPermission;
};

How do I get the VisualGC to work in this scenario? Are there any logs for VisualVM to know what's going on? Any other tools that I can use to visually see GC statistics? Any help is much appreciated. Thanks.


Solution

  • What happen if you try to run jstatd with full path?

    sudo -u neo4j /usr/lib/jvm/java-8-oracle/bin/jstatd -p 8888 -J-Djava.security.policy=/home/ubuntu/tools.policy -J-Djava.rmi.server.hostname=neo4j_ip_address