VisualVM无法启动

时间:2018-12-08 18:51:09

标签: ubuntu-18.04 visualvm jvisualvm

升级到Ubuntu 18.10后,VisualVM 1.3.9-1无法启动。它是通过软件包管理器安装的,我真的不想手动安装。我尝试使用以下日志记录来打开它:

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

它给出了这个输出

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)

系统上安装的Java如下

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)

2 个答案:

答案 0 :(得分:1)

我在Debian stable和visualvm 1.3.9以及1.4.2和1.4.2上都遇到了相同的错误。

对我有用的解决方法是使用以下命令(即与Tomas Hurka提供的答案相同):

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

当然,要使其正常工作,您需要安装openjdk-11-jdk。您的路径可能需要针对您的系统进行调整;这个想法是在Java 9或更高版本的运行时中运行。

(作为参考,我认为在我的案例中潜在的Debian错误是https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=897945

答案 1 :(得分:0)

尝试在JDK 8上运行VisualVM 1.3.9。您可以执行以下操作:

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

可以通过以下方式启用日志记录:-J-Dnetbeans.logger.console=true