Running ClassDump on a simple java program generates NullPointerException. Lot of exceptions of the following form are generated
Attaching to process ID 5874, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 10-internal+0-adhoc.sharath.hs
java.lang.NullPointerException
at java.base/java.util.StringTokenizer.<init>(StringTokenizer.java:199)
at java.base/java.util.StringTokenizer.<init>(StringTokenizer.java:221)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.PackageNameFilter.<init>(PackageNameFilter.java:41)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.PackageNameFilter.<init>(PackageNameFilter.java:36)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:4
5)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
at java.base/java.lang.Class.newInstance(Class.java:557)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump.run(ClassDump.java:86)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:223)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump.main(ClassDump.java:180)
java/util/Collections$EmptySet
java.lang.NullPointerException
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.PackageNameFilter.canInclude(PackageNameFilter.java:54)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump.dumpKlass(ClassDump.java:138)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump.access$000(ClassDump.java:38)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump$1.visit(ClassDump.java:109)
at jdk.hotspot.agent/sun.jvm.hotspot.memory.Dictionary.classesDo(Dictionary.java:68)
at jdk.hotspot.agent/sun.jvm.hotspot.memory.SystemDictionary.classesDo(SystemDictionary.java:190)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump.run(ClassDump.java:105)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:223)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump.main(ClassDump.java:180)
The same programs works for ObjectHistogram:
Attaching to process ID 5874, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 10-internal+0-adhoc.sharath.hs
Iterating over heap. This may take a while...
Object Histogram:
num #instances #bytes Class description
--------------------------------------------------------------------------
1: 906184 29217208 byte[]
2: 222005 14208256 java.util.Hashtable$Entry[]
3: 179365 5739680 sun.nio.fs.UnixPath
4: 111129 5334192 java.util.Hashtable
5: 88942 2134608 java.lang.String
6: 15879 2032512 sun.nio.fs.UnixFileAttributes
7: 30993 1941432 int[]
8: 15259 854504 java.util.stream.ReferencePipeline$Head
9: 16475 527200 java.nio.file.FileTreeWalker$Event
<snip>
Attaching to process ID 5874, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 10-internal+0-adhoc.sharath.hs
java.lang.NullPointerException
at java.base/java.util.StringTokenizer.<init>(StringTokenizer.java:199)
at java.base/java.util.StringTokenizer.<init>(StringTokenizer.java:221)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.PackageNameFilter.<init>(PackageNameFilter.java:41)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.PackageNameFilter.<init>(PackageNameFilter.java:36)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:4
5)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
at java.base/java.lang.Class.newInstance(Class.java:557)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump.run(ClassDump.java:86)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:223)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump.main(ClassDump.java:180)
java/util/Collections$EmptySet
java.lang.NullPointerException
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.PackageNameFilter.canInclude(PackageNameFilter.java:54)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump.dumpKlass(ClassDump.java:138)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump.access$000(ClassDump.java:38)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump$1.visit(ClassDump.java:109)
at jdk.hotspot.agent/sun.jvm.hotspot.memory.Dictionary.classesDo(Dictionary.java:68)
at jdk.hotspot.agent/sun.jvm.hotspot.memory.SystemDictionary.classesDo(SystemDictionary.java:190)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump.run(ClassDump.java:105)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:223)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump.main(ClassDump.java:180)
The same programs works for ObjectHistogram:
Attaching to process ID 5874, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 10-internal+0-adhoc.sharath.hs
Iterating over heap. This may take a while...
Object Histogram:
num #instances #bytes Class description
--------------------------------------------------------------------------
1: 906184 29217208 byte[]
2: 222005 14208256 java.util.Hashtable$Entry[]
3: 179365 5739680 sun.nio.fs.UnixPath
4: 111129 5334192 java.util.Hashtable
5: 88942 2134608 java.lang.String
6: 15879 2032512 sun.nio.fs.UnixFileAttributes
7: 30993 1941432 int[]
8: 15259 854504 java.util.stream.ReferencePipeline$Head
9: 16475 527200 java.nio.file.FileTreeWalker$Event
<snip>