JVISUALVM Remote Connection JBoss

Source: Internet
Author: User

Because JBoss is used as a Web container in your project, you need to observe some of the JVM's parameters in real time whenever the project is on-line with LoadRunner to perform a performance test of the project. If you want to use JVISUALVM to connect to the JVM on the server remotely with JSTATD, it never succeeds.

Find a lot of information on the Internet has not been successful, and eventually read the JDK through the relevant source code finally make JVISUALVM with JSTATD to remotely connect JBoss. Close up this post records the process of solving the problem.

When you enter JSTATD in the command, the following error occurs:

Find a lot of information on the Internet to resolve this error, the actual operation is still not resolved by this error.

Create a security policy file and name it Jstatd.all.policy
Grant CodeBase "file:${java.home}/. /lib/tools.jar "{
Permission java.security.AllPermission;
};

The reason for this error was found by reading the source code of JSTATD, which was to call the 139th line of the class

System.setproperty ("Java.rmi.server.ignoreSubClasses", "true");

Depending on the Java security sandbox mechanism, you need to add the following in the Jstatd.all.policy configuration file:

Grant {
Permission Java.util.PropertyPermission "Java.rmi.server.ignoreSubClasses", "write";

};

So the complete Jstatd.all.policy configuration file is as follows

Grant CodeBase "file:${java.home}/. /lib/tools.jar " {    permission java.security.AllPermission;} ; Grant {  "java.rmi.server.ignoreSubClasses", "write"; };

When the above problem is resolved, the JSTATD on the remote connection server through JVISUALVM is not connected. This is a line of code found by reading the RMI registry source of the JDK:

1  Try {2       host = java.net.InetAddress.getLocalHost (). gethostaddress (); 3   Catch (Exception e) {4        // If that failed, at least try "" (localhost) anyway ... 5        Host = ""; 6  }

This code is to get the local IP address. If you do not add the IP corresponding to the native machine name in the native host file, this line of code will return 127.0.0.1 this also causes the JVISUALVM to not connect remotely jstatd.

Here's the complete step

Go to the JDK installation directory, create the Jstatd.all.policy file under/usr/java/jdk1.6.0_45/jre/lib/security, and the contents of the file are as follows:

Grant CodeBase "file:${java.home}/. /lib/tools.jar " {    permission java.security.AllPermission;} ; Grant {  "java.rmi.server.ignoreSubClasses", "write"; };

Edit the Java.security file under the/usr/java/jdk1.6.0_45/jre/lib/security path policy.url.3=file:${java.home}/lib/security/ Jstatd.all.policy if POLICY.URL.3 already exists

You can use POLICY.URL.N N to represent a positive integer.

 

Edit the host file, add the machine name <---> IP map

After completing the above two steps, run the JSTATD parameter, because there is no port specified, RMI default registration uses a port of 1099 to see if JSTATD has run successfully

The above appears, indicating that the JSTATD has run successfully. Shut down the Linux firewall. After you try to use JVISUALVM remote connection JSTATD on the local computer.

It is finally possible to remotely connect to JBoss via JVISUALVM, but the CPU and display thread tabs are not available in JVISUALVM, and this problem is further resolved later.

Version of the JDK used by the remote server:

Java (TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot (TM) Client VMs (build 20.45-b01, mixed mode, sharing)

The version of JBoss that the remote server uses is:

jboss-eap-6.3

JVISUALVM Remote Connection JBoss

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.