`
java_true
  • 浏览: 110989 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

JProfiler安装篇

    博客分类:
  • java
阅读更多
jprofiler简介
JProfiler是一个全功能的Java剖析工具(profiler),专用于分析J2SE和J2EE应用程序。
它把CPU、执行绪和内存的剖析组合在一个强大的应用中。JProfiler可提供许多IDE整合和应用服务器整合用途。JProfiler直觉式的GUI让你可以找到效能瓶颈、抓出内存漏失(memory leaks)、并解决执行绪的问题。它让你得以对heap walker作资源回收器的root analysis,可以轻易找出内存漏失;heap快照(snapshot)模式让未被参照(reference)的对象、稍微被参照的对象、或在终结(finalization)队列的对象都会被移除;整合精灵以便剖析浏览器的Java外挂功能。

安装步骤:
系统服务器:
操作系统:linux
web服务器:Tomcat5.5
java虚拟机版本:1.5.2
jprofiler版本:jprofiler_linux_5_1_4.tar.gz(安装包共三个版本 sh,exe,tar.gz)
客户端:
操作系统:Windows Xp SP2
jprofiler5.1.4 for windows(安装包:jprofiler_windows_5_1_4.zip)

一.客户端安装:
1 windows下直接解压zip包,运行jprofiler5.1.2的exe安装即可。
2 运行jprofiler并进行配置
1)Quick Start:
       选择 An application on a remote computer
       ->Next
2)Local or remote:
       The profiled application s located 选择 On a remote computer,
      Platform of the remote computer 下拉菜单选择“Linux X86/AMD64”
      ->Next
3)Remote address :填写被监控应用程序所在远程计算机的IP
4)Installation directory:解压路径:/var/jprofiler5
5) choose JVM :
     JVM Vendor: Sun jvm提供商
    Version:1.5.0 版本
     Mode:hotspot 系统默认
6)jprofile port :8849
7)startup mode:
      Wait for ……   为了在开发环境中获取监控的信息,它将等待远程计算机上的Jprofile GUI 启动,并和本机建立连接,这种方式比较便于修改jprofiler的配置信息。
        Don't wait for …… 不必等待远程计算机的Jprofile GUI 先启动和建立连接,立即启动。但在启动远程应用程序前必须校验当前所配置会话的配置文件。虚拟机参数将参考Jprofile 的config 文件的路径。
这里选择Don't wait for ……
      ->Next
8) Config synchronization:
      Directory for config file in the remote computer:/opt (远程config文件的路径)
      同步方式:
    Manual synchronization;copy to diretory;execute command:
      提供三种同步方式,这里我选择的是第一个手工同步。
     ->Next
9)Perform modifications:
     Integration type: [Generic application]
     Selected JVM: Sun 1.4.2 (hotspot)
    Startup mode: Don't wait for JProfiler GUI, startup immediately
     Important: The local config file C:\Documents and Settings\Jan\.jprofiler5\config.xml must be copied manually to /opt on the remote computer when the profiling settings are changed.

    (1) Please insert
         -Xrunjprofiler:port=8849,nowait,id=115,config=/opt/config.xml -Xbootclasspath/a:/var/jprofiler5/bin/agent.jar
      into the start command of your remote application right after the java command.
     (2) Please add
         /var/jprofiler5/bin/linux-x86
     to the environment variable LD_LIBRARY_PATH.
      A remote session named Remote application on 10.5.31.49 will be created that connects to a running instance of the remote application that is started with the modified start command.

      这里的黑体文字部分要保存下来,在服务器端安装时会用到。
      ->Next
   10) Finished:
        选No,I will start the session later
      因为我们还没有配置服务器端。
二.服务器端安装
1 将jprofiler_linux_5_1_2.tar.gz上传到服务器上,/var/下建立jprofiler5目录,并将程序解压到/opt/jprofiler5下即可
2 修改用户环境变量.bashrc。
    加入 :
      LD_LIBRARY_PATH=/opt/jprofiler5/bin/linux-x86:$LD_LIBRARY_PATH
     export LD_LIBRARY_PATH

    如果是 64 位服务器,则选择linux-x64。
    虽然服务器是64未的,但是设置为linux-x64总是不能正确加载,报错:
    A different instance of the native library has been loaded. Please check the appropriate environment variable. (PATH, LD_LIBRARY_PATH, DYLD_LIBRARY_PATH)。
    设置为linux-x86即可。
    个人感觉Linux64根本没有启动,因为每次启动的时候报的是加载的是32位的。
       JProfiler> Using JVMTI
      JProfiler> 32-bit library
    运行source .bashrc使环境变量立即生效
  
3.修改tomcat启动文件catalina.sh,在顶部加上:
  CATALINA_OPTS="-agentlib:jprofilerti=port=8849  -Xbootclasspath/a:/opt/jprofiler5/bin/agent.jar $CATALINA_OPTS"
export CATALINA_OPTS

启动tomcat,启动客户端即可。

几个错误:
1.报错JProfiler> ERROR: Invalid license key. Aborting.
个人试验网上的破解的key不起作用。服务器端经过我个人验证是不需要key的,只有客户端需要。
2.客户端报错,版本不一致。
主要验证的是服务器端启动时的"JProfiler> Protocol version 25"信息,最初在官方下的5.1.4的安装sh文件,version为27,下载的压缩包,版本才一致。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics