简单的Jprofiler设置无法正常工作

时间:2011-04-15 14:54:36

标签: java tomcat jprofiler

我正在尝试启动并运行一个简单的本地主机JProfiler会话。我创建了会话,主机是127.0.0.1,端口是默认的8849,我已经将启动/关闭命令指向我的本地tomcat安装startup.sh/shutdown.sh。我点击确定,我得到“连接到127.0.0.1:8849”,150秒后(我修改了超时)它超时并说:

无法连接到127.0.0.1:8849。请确保远程地址正确,远程程序正确启动,网络路由允许套接字连接。

地址不可能出错,我已经验证了(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

打开端口还需要做些什么吗?例如,我应该修改传递给tomcat的JAVA_OPTS吗?

4 个答案:

答案 0 :(得分:4)

是。 你需要这样的东西(适用于OS X)

export JAVA_OPTS="-agentlib:jprofilerti=port=8849  \
   -Xbootclasspath/a:/Applications/jprofiler5/bin/agent.jar"

export DYLD_LIBRARY_PATH=/Applications/jprofiler5/bin/macos

通常在JProfiler中通过向导配置新会话时,它会告诉您需要输入的确切参数。

对我来说,这个向导是StartCenter - >新建会话,然后选择“新远程集成”。 然后,这将询问本地/远程,启动模式,jvm类型,分析端口,并在第6页上说“执行所需的修改”并列出这些。

或者,您可以从菜单栏中选择“集成向导”。

答案 1 :(得分:1)

步骤1:在Linux机器中打开.bash_profile目录中的/root文件。 在enter code here。bash_profile文件中输入jprofiller位置(使用下面的命令导出)

export LD_LIBRARY_PATH=/dsvol/jprofiler6/bin/linux-x86

第2步:进入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"

第3步:通过执行starup.sh命令从bin文件夹启动服务器

答案 2 :(得分:1)

最简单的配置方法是遵循这里描述的JProfiler提供的向导,还有非GUI向导非常方便:

http://resources.ej-technologies.com/jprofiler/help/doc/indexRedirect.html?http&&&resources.ej-technologies.com/jprofiler/help/doc/sessions/remote.html

例如对于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 "$@"

祝你好运

答案 3 :(得分:0)

-agentpath:/Applications/JProfiler.app/Contents/Resources/app/bin/macos/libjprofilerti.jnilib  -Xbootclasspath/a:/Applications/JProfiler.app/Contents/Resources/app/bin/agent.jar

这对我有用,JProfiler 9.1.1; OSX 10.11.3