All Projects → hengyunabc → Dumpclass

hengyunabc / Dumpclass

Dump classes from running JVM process.

Programming Languages

java
68154 projects - #9 most used programming language
bytecode
52 projects

Projects that are alternatives of or similar to Dumpclass

Kotlin Result
A multiplatform Result monad for modelling success or failure operations.
Stars: ✭ 369 (+136.54%)
Mutual labels:  jvm, class
JavaResolver
Java class file inspection library for .NET.
Stars: ✭ 39 (-75%)
Mutual labels:  jvm, class
jvm-dump-proxy
A proxy DLL for Windows to dump JVM classes at JNI level
Stars: ✭ 53 (-66.03%)
Mutual labels:  jvm, dump
Jvm
🤗 JVM 底层原理最全知识总结
Stars: ✭ 7,756 (+4871.79%)
Mutual labels:  jvm, class
Chymyst Core
Declarative concurrency in Scala - The implementation of the chemical machine
Stars: ✭ 142 (-8.97%)
Mutual labels:  jvm
Laravel Artisan Dd
Quickly run some code via Artisan
Stars: ✭ 136 (-12.82%)
Mutual labels:  dump
Xxl Glue
a distributed logical management platform. (分布式逻辑管理平台XXL-GLUE)
Stars: ✭ 133 (-14.74%)
Mutual labels:  jvm
Vision4j Collection
Collection of computer vision models, ready to be included in a JVM project
Stars: ✭ 132 (-15.38%)
Mutual labels:  jvm
Play Scala Isolated Slick Example
Example Play Slick Project
Stars: ✭ 155 (-0.64%)
Mutual labels:  jvm
Nudge4j
Get inside your JVM
Stars: ✭ 144 (-7.69%)
Mutual labels:  jvm
Tyrian
Full-featured TypeScript on JVM
Stars: ✭ 138 (-11.54%)
Mutual labels:  jvm
Three.kt
Three.js port for the JVM (desktop)
Stars: ✭ 136 (-12.82%)
Mutual labels:  jvm
Tokens
Java library for conveniently verifying and storing OAuth 2.0 service access tokens
Stars: ✭ 142 (-8.97%)
Mutual labels:  jvm
Dumpling
Dumpling is a fast, easy-to-use tool written by Go for dumping data from the database(MySQL, TiDB...) to local/cloud(S3, GCP...) in multifarious formats(SQL, CSV...).
Stars: ✭ 134 (-14.1%)
Mutual labels:  dump
React Universal Hooks
🎉 React Universal Hooks : just use****** everywhere (Functional or Class Component). Support React DevTools!
Stars: ✭ 148 (-5.13%)
Mutual labels:  class
Awesome Ai Services
An overview of the AI-as-a-service landscape
Stars: ✭ 133 (-14.74%)
Mutual labels:  jvm
Kivm
🌟This is a pure C++ implementation of Java Virtual Machine (only Java 8 is supported). Inspired by Hotspot In Action.
Stars: ✭ 137 (-12.18%)
Mutual labels:  jvm
Nd4j
Fast, Scientific and Numerical Computing for the JVM (NDArrays)
Stars: ✭ 1,742 (+1016.67%)
Mutual labels:  jvm
Kotlinx Benchmark
Kotlin multiplatform benchmarking toolkit
Stars: ✭ 137 (-12.18%)
Mutual labels:  jvm
Inspectit Ocelot
inspectIT Ocelot - Java agent for collecting application performance, tracing and behavior data
Stars: ✭ 135 (-13.46%)
Mutual labels:  jvm

Dumpclass

Dump classes from running JVM process by sa-jdi.jar.

  • Support wildcard match

  • Support multi classloader

Download dumpclass.jar

You can download dumpclass.jar from maven center.

http://search.maven.org/#search%7Cga%7C1%7Cdumpclass

wget http://search.maven.org/remotecontent?filepath=io/github/hengyunabc/dumpclass/0.0.2/dumpclass-0.0.2.jar -O dumpclass.jar

Usage

Usage:
 pattern                  : class name wildcard match pattern
 --noStat                 : do not print dump stat (default: false)
 --sensitive              : class name wildcard match sensitive. In mac os, try
                            this option. (default: false)
 -c (--classLoaderPrefix) : classLoaderPrefix (default: false)
 -o (--outputDir) VAL     : outputDir
 -p (--pid) N             : pid

Example:
  java -jar dumpclass.jar -p 4345 *StringUtils
  java -jar dumpclass.jar -p 4345 -o /tmp/dump *StringUtils
  java -jar dumpclass.jar -p 4345 -o /tmp/dump --classLoaderPrefix  *StringUtils
Use the specified sa-jdi.jar:
  java -cp './dumpclass.jar:$JAVA_HOME/lib/sa-jdi.jar' io.github.hengyunabc.dumpclass.DumpMain 4345 *StringUtils

Trouble

  • Try to use sudo
Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process. Could be caused by an incorrect pid or lack of privileges.
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process. Could be caused by an incorrect pid or lack of privileges.
	at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal$BsdDebuggerLocalWorkerThread.execute(BsdDebuggerLocal.java:169)
	at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal.attach(BsdDebuggerLocal.java:287)
	at sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:671)
	at sun.jvm.hotspot.HotSpotAgent.setupDebuggerDarwin(HotSpotAgent.java:659)
	at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:341)
	at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:304)
	at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140)
	at sun.jvm.hotspot.tools.Tool.start(Tool.java:185)
	at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
	at sun.jvm.hotspot.tools.jcore.ClassDump.main(ClassDump.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at io.github.hengyunabc.dumpclass.DumpMain.run(DumpMain.java:132)
	at io.github.hengyunabc.dumpclass.DumpMain.doMain(DumpMain.java:68)
	at io.github.hengyunabc.dumpclass.DumpMain.main(DumpMain.java:61)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at io.github.hengyunabc.dumpclass.DumpMain$2.run(DumpMain.java:184)
	at java.lang.Thread.run(Thread.java:745)
Caused by: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process. Could be caused by an incorrect pid or lack of privileges.
	at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal.attach0(Native Method)
	at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal.access$100(BsdDebuggerLocal.java:65)
	at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal$1AttachTask.doit(BsdDebuggerLocal.java:278)
	at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal$BsdDebuggerLocalWorkerThread.run(BsdDebuggerLocal.java:144)
  • Make sure use the same jdk version.
Attaching to process ID 53577, please wait...
Exception in thread "main" java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at io.github.hengyunabc.dumpclass.DumpMain.main(DumpMain.java:101)
Caused by: java.lang.InternalError: void* type hasn't been seen when parsing int*
	at sun.jvm.hotspot.HotSpotTypeDataBase.recursiveCreateBasicPointerType(HotSpotTypeDataBase.java:721)
	at sun.jvm.hotspot.HotSpotTypeDataBase.lookupType(HotSpotTypeDataBase.java:134)
	at sun.jvm.hotspot.HotSpotTypeDataBase.lookupOrCreateClass(HotSpotTypeDataBase.java:631)
	at sun.jvm.hotspot.HotSpotTypeDataBase.createType(HotSpotTypeDataBase.java:751)
	at sun.jvm.hotspot.HotSpotTypeDataBase.readVMTypes(HotSpotTypeDataBase.java:195)
	at sun.jvm.hotspot.HotSpotTypeDataBase.<init>(HotSpotTypeDataBase.java:89)
	at sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:403)
	at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:305)
	at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140)
	at sun.jvm.hotspot.tools.Tool.start(Tool.java:185)
	at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
	at sun.jvm.hotspot.tools.jcore.ClassDump.main(ClassDump.java:180)
	... 5 more
  • One class loaded by multi ClassLoader

Try to use HSDB. After attach java process, "Tools", "Class Browser".

sudo java -classpath "$JAVA_HOME/lib/sa-jdi.jar" sun.jvm.hotspot.HSDB

complie dumpclass.jar

mvn clean package
ls -alh target

License

Apache License V2

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].