Cannot open some applications in VisualVM
Asked Answered
W

3

6

I am using Ubuntu 14.04 with Oracle JDK 8. I want to inspect performance of my application using VisualVM. I can inspect other applications like JDownloader but I can't inspect my own applications and Eclipse 4.3. Before I made fresh install of Ubuntu, I was using JDK 7 and I have no problem and using it without any configuration. It gives following log.

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)
Wreck answered 1/6, 2014 at 12:56 Comment(4)
Does JVisualVM run with Java 8 too?Rothman
@Rothman It is included in JDK 8.Wreck
Mmh, strange. Unfortunately, I can’t reproduce it here…Rothman
I have limited time so I profiled my code on another computer with JDK 7 installed. But this question should stay open so someone can solve this in future.Wreck
U
5

run eclipse and your application with jvm parameters -Duser.language=en -Duser.country=us ...
then you will be able profile with jvisualvm.

for eclise put this two lines in eclipse.ini

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

maybe your pre installed Ubuntu had languge settings as english and you was ok.

Ulland answered 1/9, 2015 at 10:37 Comment(2)
This solved my issue of being unable to sample CPU whilst profiling a local Wildfly instance, but I'm curious as to why it's these parameters that cause the issue. We're maintaining a multi-language system with containers dependent on these properties and it just doesn't make much sense to change the parameters so that we can profile some function call.Collie
did not solve my problem :/ Running on windows machineMillham
H
7

you should run visualvm on the same JDK version as your app, look at help->about->details (Java), mine was surprisingly jdk8 instead of jdk13 (I have both), so you can setup JDK version for visualvm manually etc/visualvm.conf, uncomment and setup parameter

visualvm_jdkhome=C:\Program Files\Java\jdk-13
Harim answered 28/10, 2019 at 19:34 Comment(0)
U
5

run eclipse and your application with jvm parameters -Duser.language=en -Duser.country=us ...
then you will be able profile with jvisualvm.

for eclise put this two lines in eclipse.ini

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

maybe your pre installed Ubuntu had languge settings as english and you was ok.

Ulland answered 1/9, 2015 at 10:37 Comment(2)
This solved my issue of being unable to sample CPU whilst profiling a local Wildfly instance, but I'm curious as to why it's these parameters that cause the issue. We're maintaining a multi-language system with containers dependent on these properties and it just doesn't make much sense to change the parameters so that we can profile some function call.Collie
did not solve my problem :/ Running on windows machineMillham
F
0

For Windows & IDE plugin users coming here, what worked for me was the following:

  • Start the process + VisualVM from your IDE -> After a shgort time the error popped up "Cannot open Application..."
  • Then, in VisualVM, manually select the the process and try to connect. -> A Windows dialog pops up asking for permission to connect the the Java process.
  • Confirm that connection to the process is allowed. -> Now it should work.

I assume the Windows security dialog is somehow swallowed/ignored by VisualVM.

Foe answered 5/7, 2023 at 8:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.