VisualVM无法在Eclipse上配置Web应用程序 [英] VisualVM is unable to profile a web application on Eclipse

查看:623
本文介绍了VisualVM无法在Eclipse上配置Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想介绍我在Tomcat和Eclipse上运行的Spring Web应用程序。我将VisualVM添加到Eclipse中,并按照以下步骤运行应用程序进行分析。

 右键单击应用程序名称> 
运行为>
运行配置>
Java应用程序>
'所选项目'>
将'org.apache.catalina.starup.Boostrap'设置为Main类的值,
还将VisualVM设置为Launcher>点击运行按钮。

VisualVM启动但显示以下消息:

 无法打开请求的应用程序

在本地我可以请参阅VisualVM,Eclipse和Tomcat。



以下异常将抛出并显示在控制台上:

 线程main中的异常java.lang.NoClassDefFoundError:
org / apache / juli / logging / LogFactory
在org.apache.catalina.startup.Bootstrap。 clinit>(Bootstrap.java:59)
导致:java.lang.ClassNotFoundException:org.apache.juli.logging.LogFactory
在java.net.URLClassLoader $ 1.run(URLClassLoader.java:372 )
在java.net.URLClassLoader $ 1.run(URLClassLoader.java:361)
在java.security.AccessController.doPrivileged(本机方法)
在java.net.URLClassLoader.findClass( URLClassLoader.java:360)
在java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher $ AppClassLoader .loadClass(Launcher.java:308)
在java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1更多

我认为问题是因为服务器选择错误。也许我应该选择Tomcat,但不知道如何。

解决方案

当VisualVM插件启动Tomcat时,可​​能是一个不完整类路径的问题。您可以尝试更正您创建的启动配置的类路径(例如,尝试从tomcat安装中添加bin / tomcat-juli.jar),但我怀疑这将很容易。



您可以尝试以下操作:




  • 启动您的Tomcat,例如从Eclipse

  • 然后手动启动VisualVM:它实际上是JDK的一部分,位于< JDK dir> / bin / jvisualvm(.exe)中

  • <在应用程序列表中,您应该看到Tomcat进程,然后双击可以打开它。

I would like to profile my Spring Web Application that is running on Tomcat and Eclipse. I added VisualVM to the Eclipse and followed below steps to run the application for profiling.

Right click on the application name > 
Run As > 
Run Configuration > 
Java Application > 
'Selected Project' > 
Set 'org.apache.catalina.starup.Boostrap' as a value for Main class, 
also selected VisualVM as the Launcher > clicked on Run button.

The VisualVM starts but shows following message:

  "Cannot open requested application"

Under local I can see VisualVM, Eclipse and Tomcat.

Following exception will be thrown and shown on console as well:

 Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/juli/logging/LogFactory
    at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:59)
Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 1 more

I reckon the issue is because of wrong server selected. Maybe I should choose Tomcat but not sure how.

解决方案

Probably an issue with an incomplete classpath when the VisualVM plugin launches Tomcat. You could try to correct the classpath of the start configuration which you created (e.g. try to add bin/tomcat-juli.jar from your tomcat installation) but I doubt this will work easily.

You can try the following:

  • start your Tomcat, e.g. from Eclipse
  • then manually start VisualVM: It is actually part of the JDK and located in <JDK dir>/bin/jvisualvm(.exe)
  • in the application list you should see the Tomcat process and then you can open it with a double click.

这篇关于VisualVM无法在Eclipse上配置Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆