Jvisualvm remote connection to jboss,

Source: Internet
Author: User

Jvisualvm remote connection to jboss,

Because jboss is used as a web container in the project, you need to use loadrunner to perform performance pressure tests on the Project whenever the project is launched. In this case, you need to observe some JVM parameters in real time. If you want to use jvisualvm to remotely connect to the JVM on the server with jstatd, it will never succeed.

After finding some information on the Internet, I have never succeeded. by reading the relevant jdk source code, I finally made jvisualvm remotely connect to jboss with jstatd. Close up this blog post to record the problem solving process.

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

Find a lot of information on the Internet to solve the error as follows. In fact, this operation still does not solve the error.

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

By reading the Jstatd source code, we can find that the cause of this error is that the error is called in line 1 of this class.

System. setProperty ("java. rmi. server. ignoreSubClasses", "true ");

According to the java Security Sandbox mechanism, add the following content to the jstatd. all. policy configuration file:

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

};

Therefore, the complete jstatd. all. policy configuration file is as follows:

grant codebase "file:${java.home}/../lib/tools.jar" {    permission java.security.AllPermission;};grant {  permission java.util.PropertyPermission "java.rmi.server.ignoreSubClasses","write";};

After the above problem is solved, the jstatd on the server cannot be remotely connected through jvisualvm. By reading the jdk rmi registration source code, we found this line of code:

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 used to obtain the local IP address. If the IP address corresponding to the local machine name is not added to the local host file, this line of code will return 127.0.0.1, which also causes jvisualvm to be unable to remotely connect to jstatd.

 

The complete steps are as follows:

Go to the jdk installation directory and create the jstatd. all. policy file under/usr/java/jdk1.6.0 _ 45/jre/lib/security. The file content is as follows:

grant codebase "file:${java.home}/../lib/tools.jar" {    permission java.security.AllPermission;};grant {  permission java.util.PropertyPermission "java.rmi.server.ignoreSubClasses","write";};

Edit java in the/usr/java/jdk1.6.0 _ 45/jre/lib/security path. security File policy. url.3 = file: $ {java. home}/lib/security/jstatd. all. policy if policy. url.3 already exists

You can use policy. url. n to represent a positive integer.

 

Edit the host file and add the ip ing to the machine name <--->

After completing the preceding two steps, run the jstatd parameter. Because no port is specified, rmi registers the default port 1099 to check whether jstatd has been successfully run.

If the above Code is displayed, the jstatd has been successfully run. Disable the linux firewall. Then try to use jvisualvm to remotely connect to jstatd on the local machine.

Jboss can be remotely connected through jvisualvm, but the cpu and display thread tabs cannot be viewed in jvisualvm. This problem will be further solved later.

Jdk version used by the remote server:

Java (TM) SE Runtime Environment (build 1.6.0 _ 45-b06)
Java HotSpot (TM) Client VM (build pipeline 45-b01, mixed mode, sharing)

The jboss version used by the remote server is:

Jboss-eap-6.3

 

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.