visualvm icon indicating copy to clipboard operation
visualvm copied to clipboard

"Not supported for this JVM" when using visualvm under Windows (Linux VM works)

Open monolied opened this issue 3 years ago • 14 comments

I try to watch an application running in a Linux Tomcat under OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode). I use a jmx connection to watch that application from a remote host.

In a Linux VM (Debian 10.9), I used visualvm 1.4.2 which installed openjdk11, connected nicely and displayed results. However, screen space and performance are limited, also the version is rather old, so I tried visualvm 2.0.7 under Windows. I tried several JDKs, among them the exact same AdoptOpenjdk the Tomcat application is running on and the 11 which worked under Linux, but I always get "Not supported for this JVM" and no results. I can't change the OpenJDK the target application is running under (and it shouldn't be necessary, since it's proven to be usable, right?) but I can change a lot in the Windows environment. But no jdk I tried (1.8, 11, 16, Open, Adopt...) seems to do the job. I didn't find any hints that you can't use Windows visualvm.exe to debug Linux applications, but could that be a problem? Anything else I could try?

monolied avatar May 14 '21 10:05 monolied

I don't think the problem is caused by JDK version. Can you please provide steps how do you get "Not supported for this JVM". Can you attach VisualVM log file?

thurka avatar May 14 '21 12:05 thurka

The steps are simply

  • under "Remote", add a remote host
  • under the crated remote host, "add jmx connection"
  • click said connection

These are the same steps I use with the working v 1.4.2 in a Linux vm on the same machine. I compared configs, they are identical. The vm is configured to use NAT, so they have the same network access.

However, while compiling this answer, I changed the proxy config to "no proxy" (it was set to using the system proxy config before, which should work?) and now I can connect fine!

logfile.txt

The logfile also identifies network connection problems which shouldn't be present. I'll try to find out more about the proxy settings, but for the moment I can say:

  • There's something fishy with the application of our proxy.pac by visualvm
  • The message "Not supported for this VM" is misleading given the circumstances

Thanks for your help!

monolied avatar May 21 '21 08:05 monolied

Oh yeah, there is this in the logfile: WARNING [org.netbeans.core.network.proxy.ProxyAutoConfig]: There was a catastrophic error with the PAC script downloaded from http://proxyconf.ourdomain/proxy.pac. Will use dummy instead. Error was : org.netbeans.core.network.proxy.pac.PacParsingException: Cannot find secure PAC script engine. Allowed engines: GraalVM:js,Graal.js,Nashorn Found engines: Will not resolve proxy configuration.

And the result seems to be no network connectivity at all, not even the local net, which should work without any config.

monolied avatar May 21 '21 09:05 monolied

I have exactly the same issue when trying to monitor GC on a remote RHEL. However, no issue with proxy PAC in my logs.

jmborer avatar Oct 19 '21 15:10 jmborer

I got the same issue. @monolied suggestion (no proxy set) don´t work for me. I´m trying to monitor remotely from Windows 10 using VisualVM 2.1.2 a JBoss VM (AdoptOpenJDK 1.8.0_265-b01). I got successfull Remote Host connection, but JMX connection appears "grey" with message "Not supported for this JVM".

hmoreira2 avatar Feb 11 '22 13:02 hmoreira2

I got the same issue for the remote application. Works properly for the local applications. VisualVM 2.1.2 running on Mac OS Big Sur java version "1.8.0_311". Remote java application running on Linux, openjdk version "1.8.0_322"

I got successful remote connection but JMX connection shows "Not supported for this JVM"

Done with jstatd grant codebase "file:${java.home}/../lib/tools.jar" { permission java.security.AllPermission; };

nohup jstatd -J-Djava.security.policy=jstatd.all.policy &

java -Xms1g -Xmx2g -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8080 -Dcom.sun.management.jmxremote.rmi.port=8080 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=stg-atrstub101z.stg.jp.local -jar app.jar &

"Not supported for this JVM" only Overview tab is available.

leojunior9799 avatar Feb 24 '22 13:02 leojunior9799

Is this a bug then?

I'm connecting from VisualVM running on Windows 10 to openjdk:17 container running on WSL 2. JMX connection gives "Not supported for this JVM".

jstatd doesn't work either because it fails with java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.rmi.server.ignoreSubClasses" "write"). Policy file doesn't help.

namedgraph avatar Sep 29 '22 07:09 namedgraph

Managed to connect! This SO answer helped: https://stackoverflow.com/a/71881475/1003113

namedgraph avatar Sep 29 '22 09:09 namedgraph

I do the same job like @leojunior9799 issue, but this plug-in does not display the gc status of remote projects. What should I do?

Y-Stone avatar Oct 12 '22 09:10 Y-Stone

Seems -Djava.rmi.server.hostname=localhost & Dcom.sun.management.jmxremote.host=localhost & -Djava.net.preferIPv4Stack=true are importan here because Windows HyperV performs some port forwarding behind the scene and you'd better to stick to IPv4 ))

gavenkoa avatar Oct 18 '22 22:10 gavenkoa

Anyway you can pass the port from remote machine (which WSL is) to your environment via SSH port forwarding. It is generic solution that doesn't require understanding of WSL/HyperV.

gavenkoa avatar Oct 18 '22 22:10 gavenkoa