3

After upgrading to Ubuntu 18.10 VisualVM 1.3.9-1 cannot start. It was installed through the package manager and I don't really want to install manually. I tried opening it with logging like:

visualvm -J-Djava.util.logging.config.file=logging-jconsole.properties

And it gives this output

java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
at org.netbeans.core.startup.layers.BinaryFS.<init>(Unknown Source)
at org.netbeans.core.startup.layers.BinaryCacheManager.load(Unknown Source)
at org.netbeans.core.startup.layers.LayerCacheManager$1Updater.run(Unknown Source)
at org.openide.filesystems.EventControl.runAtomicAction(Unknown Source)
at org.openide.filesystems.FileSystem.runAtomicAction(Unknown Source)
at org.openide.filesystems.FileUtil.runAtomicAction(Unknown Source)
at org.netbeans.core.startup.layers.LayerCacheManager.store(Unknown Source)
at org.netbeans.core.startup.layers.ModuleLayeredFileSystem.setURLs(Unknown Source)
at org.netbeans.core.startup.layers.ModuleLayeredFileSystem.addURLs(Unknown Source)
at org.netbeans.core.startup.NbInstaller.loadLayers(Unknown Source)
at org.netbeans.core.startup.NbInstaller.loadImpl(Unknown Source)
at org.netbeans.core.startup.NbInstaller.access$000(Unknown Source)
at org.netbeans.core.startup.NbInstaller$1.run(Unknown Source)
at org.openide.filesystems.FileUtil$2.run(Unknown Source)
at org.openide.filesystems.EventControl.runAtomicAction(Unknown Source)
at org.openide.filesystems.FileSystem.runAtomicAction(Unknown Source)
at org.openide.filesystems.FileUtil.runAtomicAction(Unknown Source)
at org.openide.filesystems.FileUtil.runAtomicAction(Unknown Source)
at org.netbeans.core.startup.NbInstaller.load(Unknown Source)
at org.netbeans.ModuleManager.enable(Unknown Source)
at org.netbeans.ModuleManager.enable(Unknown Source)
at org.netbeans.core.startup.ModuleList.installNew(Unknown Source)
at org.netbeans.core.startup.ModuleList.trigger(Unknown Source)
at org.netbeans.core.startup.ModuleSystem.restore(Unknown Source)
at org.netbeans.core.startup.Main.getModuleSystem(Unknown Source)
at org.netbeans.core.startup.Main.getModuleSystem(Unknown Source)
at org.netbeans.core.startup.Main.start(Unknown Source)
at org.netbeans.core.startup.TopThreadGroup.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)

The Javas installed on the system are as follows

matthew@matthew-Kratos:~$ ls /usr/lib/jvm/
default-java               java-11-openjdk-amd64     java-8-openjdk-amd64
java-1.11.0-openjdk-amd64  java-1.8.0-openjdk-amd64  java-9-openjdk-amd64
matthew@matthew-Kratos:~$ dpkg-query -l | grep openjdk
ii  openjdk-11-jdk:amd64                       11.0.1+13-2ubuntu1                         amd64        OpenJDK Development Kit (JDK)
ii  openjdk-11-jdk-headless:amd64              11.0.1+13-2ubuntu1                         amd64        OpenJDK Development Kit (JDK) (headless)
ii  openjdk-11-jre:amd64                       11.0.1+13-2ubuntu1                         amd64        OpenJDK Java runtime, using Hotspot JIT
ii  openjdk-11-jre-headless:amd64              11.0.1+13-2ubuntu1                         amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
ii  openjdk-8-jdk:amd64                        8u191-b12-0ubuntu0.18.10.1                 amd64        OpenJDK Development Kit (JDK)
ri  openjdk-8-jdk-headless:amd64               8u191-b12-0ubuntu0.18.10.1                 amd64        OpenJDK Development Kit (JDK) (headless)
ii  openjdk-8-jre:amd64                        8u191-b12-0ubuntu0.18.10.1                 amd64        OpenJDK Java runtime, using Hotspot JIT
ii  openjdk-8-jre-headless:amd64               8u191-b12-0ubuntu0.18.10.1                 amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
rc  openjdk-9-jre-headless:amd64               9~b161-1                                   amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
MitchBroadhead
  • 811
  • 14
  • 23

2 Answers2

3

I get the same error with Debian unstable and visualvm 1.3.9 as well as 1.4.2.

The workaround that helped for me was to use the following (i.e. the same answer as provided by Tomas Hurka):

visualvm --jdkhome /usr/lib/jvm/java-11-openjdk-amd64

Of course, for this to work you need to install openjdk-11-jdk. Your path might need to be adjusted for your system; the idea is to run with a Java 9 or newer runtime.

(For reference, I think the underlying Debian bug in my case is https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=897945)

Per Lundberg
  • 3,837
  • 1
  • 36
  • 46
  • 3
    Using JDK 11, I get: ```Error occurred during initialization of boot layer java.lang.module.FindException: Module java.activation not found``` (VisualVM 1.3.9) – Bernie Mar 05 '19 at 05:58
  • 1
    Oh, I see - VisualVM versions prior to 1.4.2 don't run on Java 11: https://github.com/oracle/visualvm/issues/108#issuecomment-418344988 – Bernie Mar 05 '19 at 06:13
0

Try to run VisualVM 1.3.9 on JDK 8. You can do it with:

visualvm --jdkhome /usr/lib/jvm/java-1.8.0-openjdk-amd64

Logging can be enabled with: -J-Dnetbeans.logger.console=true

Tomas Hurka
  • 6,723
  • 29
  • 38