java 简单的 Jprofiler 设置不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5678557/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Simple Jprofiler setup not working
提问by Kevin
I'm trying to get a simple, localhost session of JProfiler up and running. I've created the session, the host is 127.0.0.1, the port is the default 8849, and I've pointed the startup/shutdown commands to my local tomcat installation startup.sh/shutdown.sh. I click OK and I get "Connecting to 127.0.0.1:8849" and after 150 seconds (I modified the timeout) it times out and says:
我正在尝试启动并运行 JProfiler 的一个简单的本地主机会话。我已经创建了会话,主机是 127.0.0.1,端口是默认的 8849,并且我已经将启动/关闭命令指向我本地的 tomcat 安装 startup.sh/shutdown.sh。我点击确定,我得到“连接到 127.0.0.1:8849”,150 秒后(我修改了超时)它超时并说:
Could not connect to 127.0.0.1:8849. Please make sure that the remote address is correct, the remote program is started properly, and the network route allows socket connections.
无法连接到 127.0.0.1:8849。请确保远程地址正确,远程程序正常启动,网络路由允许socket连接。
The address can't possibly be wrong, and I've verified (ps -ef|grep tomcat) that the process is up, and also checked the tomcat log and it's waiting for requests:
地址不可能是错误的,我已经验证 (ps -ef|grep tomcat) 进程已启动,还检查了 tomcat 日志,它正在等待请求:
INFO: Starting Coyote HTTP/1.1 on http-8080
Apr 15, 2011 7:49:13 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Apr 15, 2011 7:49:13 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/21 config=null
Apr 15, 2011 7:49:13 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 47312 ms
Is there something else I need to do to open the port? For instance am I supposed to modify the JAVA_OPTS that get passed to tomcat?
我还需要做些什么来打开端口吗?例如,我应该修改传递给 tomcat 的 JAVA_OPTS 吗?
回答by Heiko Rupp
Yes. you need something like this (for OS X)
是的。你需要这样的东西(对于 OS X)
export JAVA_OPTS="-agentlib:jprofilerti=port=8849 \
-Xbootclasspath/a:/Applications/jprofiler5/bin/agent.jar"
export DYLD_LIBRARY_PATH=/Applications/jprofiler5/bin/macos
Usually when you configure a new session through the wizard in JProfiler, it will tell you those exact parameters that you need to put in.
通常,当您通过 JProfiler 中的向导配置新会话时,它会告诉您需要输入的确切参数。
For me this wizard is StartCenter -> New Session , then select "New remote integration". This will then ask local/remote , startup mode, jvm type, profiling port and on page 6 says "Perform required modifications" and it lists those.
对我来说,这个向导是 StartCenter -> New Session ,然后选择“New remote integration”。这将询问 local/remote 、启动模式、jvm 类型、分析端口,并在第 6 页上说“执行所需的修改”并列出这些。
Alternatively you can select "Integration wizard" from the menu bar.
或者,您可以从菜单栏中选择“集成向导”。
回答by Madhu Cheepati
Step 1:In Linux machine open .bash_profile
file from /root
directory.
Enter jprofiller location (using below command export) in enter code here
.bash_profile file
第 1 步:在 Linux 机器上打开目录中的.bash_profile
文件/root
。在enter code here
.bash_profile 文件中输入 jprofiller 位置(使用下面的命令导出)
export LD_LIBRARY_PATH=/dsvol/jprofiler6/bin/linux-x86
Step 2:Go into Tomcat installation directory. Open catalina.sh
file from bin
folder
Enter the below details in catalina.sh
file (only red color information and black color you can find by default in catalina.sh
file)
第二步:进入Tomcat安装目录。catalina.sh
从bin
文件夹打开文件 在文件中输入以下详细信息catalina.sh
(默认情况下,您只能在catalina.sh
文件中找到红色和黑色信息)
export JPROFILER_HOME
JAVA_OPTS="-Xms768m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=256m -Dfile.encoding=UTF8 -agentpath:/opt/Performance/jprofiler7/bin/linux-x86/libjprofilerti.so=port=8849 $CATALINA_OPTS"
Step 3:Start the server from bin folder by executing the starup.sh
command
步骤3:通过执行starup.sh
命令从bin文件夹启动服务器
回答by Ruslans Uralovs
The easiest way to configure would be to follow the wizards provided by JProfiler which is described here, there are also non-GUI wizards which are very handy:
最简单的配置方法是按照此处描述的 JProfiler 提供的向导进行操作,还有非常方便的非 GUI 向导:
For example for Tomcat the following is automatically inserted into Tomcat's startup.sh script, which means you don't have to guess:
例如对于Tomcat,以下内容会自动插入到Tomcat的startup.sh脚本中,这意味着您不必猜测:
# The following lines have been added by the
# application server integration wizard of JProfiler
CATALINA_OPTS="-agentpath:/local/jprofiler8/bin/linux-x64/libjprofilerti.so=port=8849,nowait $CATALINA_OPTS"
export CATALINA_OPTS
# end of modifications
exec "$PRGDIR"/"$EXECUTABLE" run "$@"
Good luck
祝你好运
回答by Daniel Deusing
-agentpath:/Applications/JProfiler.app/Contents/Resources/app/bin/macos/libjprofilerti.jnilib -Xbootclasspath/a:/Applications/JProfiler.app/Contents/Resources/app/bin/agent.jar
This is working for me, JProfiler 9.1.1; OSX 10.11.3
这对我有用,JProfiler 9.1.1;OSX 10.11.3