我正在尝试在ubuntu上配置运行tomcat7的远程服务器。我已经阅读了多个教程但无法运行它。
远程服务器上的JProfiler集成
我首先在远程系统上下载 jprofiler9并解压。
wget http://download-keycdn.ej-technologies.com/jprofiler/jprofiler_linux_9_2.tar.gz
tar -xzf jprofiler_linux_9_2.tar.gz
并运行以下命令
jprofiler9/bin# ./jpintegrate
它向我询问了一些信息并生成了2个文件
startup.sh
创建的,因为上面的向导要求我提供启动脚本的路径(/ usr / share / tomcat7 / bin / startup.sh)所以在同一个文件夹中创建了新文件。更改内容startup-jp.sh如下
# The following lines have been added by the
# application server integration wizard of JProfiler
CATALINA_OPTS="-agentpath:/home/ubuntu/jprofiler9/bin/linux-x64/libjprofilerti.so=port=8383 $CATALINA_OPTS"
export CATALINA_OPTS
# end of modifications
exec "$PRGDIR"/"$EXECUTABLE" run "$@"
Statring JProfiler 在这里我很困惑如何运行jprofiler,我想运行startup-jp.sh将启动探查器
它成功运行但是当我使用JProfiler GUI从我的本地系统连接到这个远程服务器时,服务器生成了很少有关未找到路径的错误
运行startup-jp.sh
后的控制台日志root# /usr/share/tomcat7/bin/startup.sh
Using CATALINA_BASE: /usr/share/tomcat7
Using CATALINA_HOME: /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
JProfiler> Protocol version 55
JProfiler> Using JVMTI
JProfiler> JVMTI version 1.1 detected.
JProfiler> 64-bit library
JProfiler> Listening on port: 8383.
JProfiler> Instrumenting native methods.
JProfiler> Can retransform classes.
JProfiler> Can retransform any class.
JProfiler> Native library initialized
JProfiler> VM initialized
JProfiler> Waiting for a connection from the JProfiler GUI ...
JProfiler> Using dynamic instrumentation
JProfiler> Time measurement: elapsed time
JProfiler> CPU profiling enabled
Oct 28, 2016 4:27:31 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
Oct 28, 2016 4:27:31 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
Oct 28, 2016 4:27:32 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
Oct 28, 2016 4:27:32 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
Oct 28, 2016 4:27:32 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
Oct 28, 2016 4:27:32 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
Oct 28, 2016 4:27:32 AM org.apache.catalina.startup.Catalina initDirs
SEVERE: Cannot find specified temporary folder at /usr/share/tomcat7/temp
Oct 28, 2016 4:27:32 AM org.apache.catalina.startup.Catalina load
WARNING: Unable to load server configuration from [/usr/share/tomcat7/conf/server.xml]
Oct 28, 2016 4:27:32 AM org.apache.catalina.startup.Catalina initDirs
SEVERE: Cannot find specified temporary folder at /usr/share/tomcat7/temp
Oct 28, 2016 4:27:32 AM org.apache.catalina.startup.Catalina load
WARNING: Unable to load server configuration from [/usr/share/tomcat7/conf/server.xml]
Oct 28, 2016 4:27:32 AM org.apache.catalina.startup.Catalina start
SEVERE: Cannot start server. Server instance is not configured.
JProfiler> Keeping VM alive until frontend disconnects.
显然它无法查看不同的必需目录(奇怪),请注意我从未运行startup.sh来启动我的tomcat7但是使用了service tomcat7 start
,可能就是这里的问题。这是tomcat7的目录结构
的/ usr /共享/ tomcat7 /
drwxr-xr-x 2 root root 4.0K Oct 28 04:21 bin
-rw-r--r-- 1 root root 39 Feb 21 2014 defaults.md5sum
-rw-r--r-- 1 root root 2.0K Feb 21 2014 defaults.template
drwxr-xr-x 2 root root 4.0K Oct 10 06:06 lib
-rw-r--r-- 1 root root 53 Feb 21 2014 logrotate.md5sum
-rw-r--r-- 1 root root 118 Feb 21 2014 logrotate.template
的/ var / lib中/ tomcat7 /
drwxr-xr-x 3 tomcat7 tomcat7 4.0K Apr 21 2016 common
lrwxrwxrwx 1 root root 12 Jun 19 2015 conf -> /etc/tomcat7
lrwxrwxrwx 1 root root 17 Jun 19 2015 logs -> ../../log/tomcat7
drwxr-xr-x 3 tomcat7 tomcat7 4.0K Apr 21 2016 server
drwxr-xr-x 3 tomcat7 tomcat7 4.0K Apr 21 2016 shared
drwxrwxr-x 6 tomcat7 tomcat7 4.0K Oct 27 06:10 webapps
lrwxrwxrwx 1 root root 19 Jun 19 2015 work -> ../../cache/tomcat7
通过在startup-jp.sh 中添加以下行来修复以上异常
export CATALINA_BASE="/var/lib/tomcat7/"
现在可以找到丢失的文件夹
新问题
现在的问题是我的本地jprofiler gui花了太多时间(比如我重新启动脚本它会捕获很少的条目,但不久之后
tomcat的CPU使用率为197.5%,由top命令
启发
因此本地jprofiler GUI无法加载任何其他内容。我无法确定造成这么多CPU使用的原因。
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5496 tomcat 38 18 3005m 675m 17m S 197.5 9.0 21:09.55 java
答案 0 :(得分:0)
集成已正确完成并按预期工作。
根据文件系统中的权限,您必须以root身份执行startup-jp.sh,因此执行
sudo sh startup-jp.sh