Schalli1987 · GitHub

When multiple users work on the same Machine, VisualVM will only work for the first user starting it properly.
All other users can't save snapshots.

Since snapshots are saved in /tmp/visualvm.dat/ this folder belongs to the first user and any other user can't write to it.

A workaround would be to add the username to the tmp folder, e.g. /tmp/visualvm.dat_USERNAME.

Here's the error stacktrace:

java.lang.IllegalStateException: Cannot create storage directory /tmp/visualvm.dat/localhost_24976
	at com.sun.tools.visualvm.core.datasource.Storage.getDirectory(Storage.java:125)
[catch] at com.sun.tools.visualvm.profiler.ProfilerSnapshotAction$SnapshotsListenerImpl.snapshotSaved(ProfilerSnapshotAction.java:120)
	at org.netbeans.modules.profiler.ResultsManager$10.run(ResultsManager.java:1060)
	at org.netbeans.lib.profiler.common.CommonUtils.runInEventDispatchThread(CommonUtils.java:61)
	at org.netbeans.modules.profiler.ResultsManager.fireSnapshotSaved(ResultsManager.java:1057)
	at org.netbeans.modules.profiler.ResultsManager.saveSnapshot(ResultsManager.java:897)
	at org.netbeans.modules.profiler.ResultsManager.saveSnapshot(ResultsManager.java:961)
	at org.netbeans.modules.profiler.ProfilerControlPanel2$ResultsSnippetPanel.snapshotTaken(ProfilerControlPanel2.java:934)
	at org.netbeans.modules.profiler.ProfilerControlPanel2$Listener.snapshotTaken(ProfilerControlPanel2.java:222)
	at org.netbeans.modules.profiler.ResultsManager$11.run(ResultsManager.java:1074)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Read the original on github.com ↗