1. Test Environment
Server: RedHat Linux 3.4.3-9. EL4 (kernel version 2.6.9-5.el), tomcat5.5.20, Sun JDK 1.5.0 _ 09, jprofiler 4.3.2 For Linux (installation package: jprofiler_linux_4_3_2.sh)
Client: Windows XP, jprofiler 4.3.2 For Windows (installation package: jprofiler_windows_4_3_2.exe)
2. jprofiler SoftwareHttp://www.ej-technologies.com/
3. Client jprofiler Installation
4. Install jprofiler on the server:
Upload jprofiler_linux_4.3.2.sh to the server. Assume the path is/opt/jprofiler.
# Cd/opt/jprofiler
# Chmod + x *. Sh
#./Jprofiler_linux_4.3.2.sh-C
Follow the prompts to install the tool. The prompts are very simple. Installation path:/opt/jprofiler4
Note: Here-C means to install it in character mode. If there is no X on the machine, this parameter is added.
5. Client Connection Configuration
1) Run jprofiler. A wizard will be displayed when you open it for the first time and ignore it.
2) Select session> integration wizard> new remote integratation.
3) Select on a remote computer; platform of Remote Computer select Linux x86/AMD 64; next
4). Enter the Server IP address. Next
5) enter the installation path of jprofiler on the server, such as/opt/jprofiler4; next
6) Select the JDK environment of the server. Here is: Sun, 1.5.0, hotspot; next
7). Input Port: The default value is 8849. Next
8). Select Start mode: select the first wait for a connection from the jprofiler GUI; next
9) The configuration that needs to be done on the server is listed here:
Integration type: [generic application]
Selected JVM: Sun 1.5.0 (Hotspot)
Startup Mode: wait for jprofiler Gui
(1) Please insert
-Agentlib: jprofilerti = Port = 8849-xbootclasspath/A:/opt/jprofiler4/bin/agent. Jar
Into the start command of your remote application right after the Java command.
(2) Please add
/Opt/jprofiler4/bin/linux-x86
To the environment variable LD_LIBRARY_PATH.
A remote session named Remote Application on 192.168.40.15 will be created that connects to a running instance of the remote application that is started with the modified start command.
6. Server Configuration
(1) modify the system environment configuration file/etc/profile and add
Jprofiler_home =/opt/jprofiler4/bin/linux-x86
Export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH: $ jprofiler_home
(2) modify the Tomcat Startup File Catalina. SH and add-agentlib: jprofilerti = Port = 8849-xbootclasspath/A:/opt/jprofiler4/bin/agent. jar to catalina_opts;
"-Agentlib: jprofilerti = Port = 8849-xbootclasspath/A:/opt/jprofiler4/bin/agent. Jar" is generated by the client software.
Catalina_opts = "$ catalina_opts-xms128m-xmx128m $ jpda_opts-agentlib: jprofilerti = Port = 8849-xbootclasspath/A:/opt/jprofiler4/bin/agent. Jar"
7. Reboot Linux and startup Tomcat using startup. Sh;
The log of Tomcat which is $ catalina_home/logs/Catalina. out will show:
Jprofiler> Protocol Version 23
Jprofiler> using jvmti
Jprofiler> 32-bit Library
Jprofiler> listening on port: 8849.
Jprofiler> native library initialized
Jprofiler> waiting for a connection from the jprofiler Gui
8. Start the client software
Click jprofiler menu session> Start center> Open Session
The configured connections are listed in available session configurations. If you select this option, it will be OK !!
9. The log of Tomcat which is $ catalina_home/logs/Catalina. out will show:
Jprofiler> using dynamic Instrumentation
Jprofiler> time measurement: elapsed time
Jprofiler> CPU profiling Enabled
Jprofiler> hotspot compiler Enabled
Jprofiler> starting ORG/Apache/Catalina/startup/Bootstrap
10. When jprofiler connection is interrupted
The log of Tomcat which is $ catalina_home/logs/Catalina. out will show:
Jprofiler> disconnected. Waiting for reconnection.
Jprofiler> listening on port: 8849.
After my tests, I found the above problems.
1) do not add-agentlib: jprofilerti = Port = 8849-xbootclasspath/A:/opt/jprofiler4/bin/agent. jarCatalina_opts And add it to java_opts in the following format:
The remaining steps are the same as above.
Java_opts = "$ java_opts"-agentlib: jprofilerti = Port = 8849
Java_opts = "$ java_opts"-xbootclasspath/A:/opt/jprofiler5/bin/agent. Jar
The following is a complete configuration I have used.
If [-R "$ catalina_home"/bin/tomcat-juli.jar]; then
Java_opts = "$ java_opts"-xms128m
Java_opts = "$ java_opts"-xmx256m
Java_opts = "$ java_opts"-XX: permsize = 32 m
Java_opts = "$ java_opts"-XX: maxnewsize = 128 m
Java_opts = "$ java_opts"-XX: maxpermsize = 64 m
Java_opts = "$ java_opts"-DCOM. Sun. Management. jmxremote
Java _opts = "$ java_opts"-DCOM. Sun. Management. jmxremote. Port = 9009
Java_opts = "$ java_opts"-DCOM. Sun. Management. jmxremote. Authenticate = false
Java_opts = "$ java_opts"-DCOM. Sun. Management. jmxremote. SSL = false
Java_opts = "$ java_opts"-agentlib: jprofilerti = Port = 8849
Java_opts = "$ java_opts"-xbootclasspath/A:/opt/jprofiler5/bin/agent. Jar
Java_opts = "$ java_opts"-djava. util. logging. manager = org. apache. juli. classloaderlogmanager ""-djava. util. logging. config. file = "$ catalina_base/CONF/logging. properties"
Fi
At that time, the problem was that jconsole could not connect to the remote JVM on Linux. Google saw a bug in the official Sun bugdatabase, so it was not enough. Google again today, at java.sun.com/j2se/1.5.0/docs/guide/management/faq.html?linux2
Run"Hostname-I"Command. if it reports 127.0.0.1, jconsole wocould not be able to connect to the JVM running on that Linux machine. to fix this issue, edit/etc/hosts so that the hostname resolves to the host address.
Modify/etc/hosts immediately. The connection is successful. For the above-mentioned test of "running the while (true); endless loop in a JSP", one thread is viewed one by one and it is found that one thread is always in the runnable state on the _ jspservice method. It seems that programmer still needs to use Google