无法在VisualVM中打开某些应用程序

时间:2014-06-01 12:56:51

标签: java eclipse java-8 visualvm

我正在使用Ubuntu 14.04和Oracle JDK 8.我想使用VisualVM检查我的应用程序的性能。我可以检查其他应用程序,如JDownloader,但我无法检查自己的应用程序和Eclipse 4.3。在我重新安装Ubuntu之前,我使用的是JDK 7,我没有任何问题并且在没有任何配置的情况下使用它。它给出了以下日志。

SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor com.sun.tools.visualvm.core.ui.DataSourceWindowManager$1
java.lang.IllegalArgumentException: Unexpected composite type for ThreadInfo
    at sun.management.ThreadInfoCompositeData.validateCompositeData(ThreadInfoCompositeData.java:372)
    at sun.management.ThreadInfoCompositeData.getInstance(ThreadInfoCompositeData.java:68)
    at java.lang.management.ThreadInfo.<init>(ThreadInfo.java:263)
    at java.lang.management.ThreadInfo.from(ThreadInfo.java:794)
Caused: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
    at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
    at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeBuilderViaFrom.fromCompositeData(DefaultMXBeanMappingFactory.java:1018)
Caused: java.io.InvalidObjectException: Failed to invoke from(CompositeData)
    at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory.invalidObjectException(DefaultMXBeanMappingFactory.java:1457)
    at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeBuilderViaFrom.fromCompositeData(DefaultMXBeanMappingFactory.java:1021)
    at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeMapping.fromNonNullOpenValue(DefaultMXBeanMappingFactory.java:919)
    at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$NonNullMXBeanMapping.fromOpenValue(DefaultMXBeanMappingFactory.java:133)
    at com.sun.jmx.mbeanserver.ConvertingMethod.fromOpenReturnValue(ConvertingMethod.java:131)
    at com.sun.jmx.mbeanserver.MXBeanProxy.invoke(MXBeanProxy.java:168)
    at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:252)
Caused: java.lang.reflect.UndeclaredThrowableException
    at com.sun.proxy.$Proxy8.getThreadInfo(Unknown Source)
    at com.sun.tools.visualvm.jmx.impl.JmxSupport.isReadOnlyConnection(JmxSupport.java:95)
    at com.sun.tools.visualvm.jmx.impl.JmxModelImpl.isTakeThreadDumpSupported(JmxModelImpl.java:311)
    at com.sun.tools.visualvm.application.views.threads.ApplicationThreadsViewProvider.resolveThreads(ApplicationThreadsViewProvider.java:65)
    at com.sun.tools.visualvm.application.views.threads.ApplicationThreadsViewProvider.supportsViewFor(ApplicationThreadsViewProvider.java:29)
    at com.sun.tools.visualvm.application.views.threads.ApplicationThreadsViewProvider.supportsViewFor(ApplicationThreadsViewProvider.java:25)
    at com.sun.tools.visualvm.core.ui.DataSourceViewsManager.getViews(DataSourceViewsManager.java:116)
    at com.sun.tools.visualvm.core.ui.DataSourceWindowManager.openWindowAndAddView(DataSourceWindowManager.java:169)
    at com.sun.tools.visualvm.core.ui.DataSourceWindowManager.access$000(DataSourceWindowManager.java:30)
    at com.sun.tools.visualvm.core.ui.DataSourceWindowManager$1.run(DataSourceWindowManager.java:80)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1393)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2005)

2 个答案:

答案 0 :(得分:4)

使用jvm参数运行eclipse和你的应用程序-Duser.language = en -Duser.country = us ...
那么你就可以用jvisualvm进行描述了。

对于eclise,将这两行放在eclipse.ini

-Duser.language=en
-Duser.country=us

也许你预先安装的Ubuntu的语言设置为英语,你还可以。

答案 1 :(得分:0)

您应该在与您的应用相同的JDK版本上运行 visualvm ,请查看 help-> about-> details (Java),我的是令人惊讶的jdk8而不是jdk13 (两者都有),因此您可以手动设置 visualvm 的JDK版本 etc / visualvm.conf ,取消注释和设置参数

visualvm_jdkhome=C:\Program Files\Java\jdk-13