{"id":13843259,"url":"https://github.com/hengyunabc/dumpclass","last_synced_at":"2025-04-06T04:14:36.712Z","repository":{"id":45801596,"uuid":"51835793","full_name":"hengyunabc/dumpclass","owner":"hengyunabc","description":"Dump classes from running JVM process.","archived":false,"fork":false,"pushed_at":"2022-08-30T09:27:18.000Z","size":25,"stargazers_count":412,"open_issues_count":5,"forks_count":86,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-30T03:07:27.072Z","etag":null,"topics":["bytecode","class","dump","java","jvm"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hengyunabc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-16T12:57:05.000Z","updated_at":"2025-03-03T12:21:12.000Z","dependencies_parsed_at":"2022-07-17T01:46:27.348Z","dependency_job_id":null,"html_url":"https://github.com/hengyunabc/dumpclass","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hengyunabc%2Fdumpclass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hengyunabc%2Fdumpclass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hengyunabc%2Fdumpclass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hengyunabc%2Fdumpclass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hengyunabc","download_url":"https://codeload.github.com/hengyunabc/dumpclass/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430963,"owners_count":20937875,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bytecode","class","dump","java","jvm"],"created_at":"2024-08-04T17:01:58.241Z","updated_at":"2025-04-06T04:14:36.390Z","avatar_url":"https://github.com/hengyunabc.png","language":"Java","readme":"# Dumpclass\nDump classes from running JVM process by sa-jdi.jar.\n\n* Support wildcard match\n\n* Support multi classloader\n\n\n### Download dumpclass.jar\n\nYou can download dumpclass.jar from maven center.\n\nhttp://search.maven.org/#search%7Cga%7C1%7Cdumpclass\n\n```bash\nwget http://search.maven.org/remotecontent?filepath=io/github/hengyunabc/dumpclass/0.0.2/dumpclass-0.0.2.jar -O dumpclass.jar\n```\n\n### Usage\n\n```\nUsage:\n pattern                  : class name wildcard match pattern\n --noStat                 : do not print dump stat (default: false)\n --sensitive              : class name wildcard match sensitive. In mac os, try\n                            this option. (default: false)\n -c (--classLoaderPrefix) : classLoaderPrefix (default: false)\n -o (--outputDir) VAL     : outputDir\n -p (--pid) N             : pid\n\nExample:\n  java -jar dumpclass.jar -p 4345 *StringUtils\n  java -jar dumpclass.jar -p 4345 -o /tmp/dump *StringUtils\n  java -jar dumpclass.jar -p 4345 -o /tmp/dump --classLoaderPrefix  *StringUtils\nUse the specified sa-jdi.jar:\n  java -cp './dumpclass.jar:$JAVA_HOME/lib/sa-jdi.jar' io.github.hengyunabc.dumpclass.DumpMain 4345 *StringUtils\n```\n\n### Trouble\n\n* Try to use sudo\n\n```\nError 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.\nsun.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.\n\tat sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal$BsdDebuggerLocalWorkerThread.execute(BsdDebuggerLocal.java:169)\n\tat sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal.attach(BsdDebuggerLocal.java:287)\n\tat sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:671)\n\tat sun.jvm.hotspot.HotSpotAgent.setupDebuggerDarwin(HotSpotAgent.java:659)\n\tat sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:341)\n\tat sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:304)\n\tat sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140)\n\tat sun.jvm.hotspot.tools.Tool.start(Tool.java:185)\n\tat sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)\n\tat sun.jvm.hotspot.tools.jcore.ClassDump.main(ClassDump.java:180)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat io.github.hengyunabc.dumpclass.DumpMain.run(DumpMain.java:132)\n\tat io.github.hengyunabc.dumpclass.DumpMain.doMain(DumpMain.java:68)\n\tat io.github.hengyunabc.dumpclass.DumpMain.main(DumpMain.java:61)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat io.github.hengyunabc.dumpclass.DumpMain$2.run(DumpMain.java:184)\n\tat java.lang.Thread.run(Thread.java:745)\nCaused by: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process. Could be caused by an incorrect pid or lack of privileges.\n\tat sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal.attach0(Native Method)\n\tat sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal.access$100(BsdDebuggerLocal.java:65)\n\tat sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal$1AttachTask.doit(BsdDebuggerLocal.java:278)\n\tat sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal$BsdDebuggerLocalWorkerThread.run(BsdDebuggerLocal.java:144)\n```\n\n* Make sure use the same jdk version.\n\n```\nAttaching to process ID 53577, please wait...\nException in thread \"main\" java.lang.reflect.InvocationTargetException\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:497)\n\tat io.github.hengyunabc.dumpclass.DumpMain.main(DumpMain.java:101)\nCaused by: java.lang.InternalError: void* type hasn't been seen when parsing int*\n\tat sun.jvm.hotspot.HotSpotTypeDataBase.recursiveCreateBasicPointerType(HotSpotTypeDataBase.java:721)\n\tat sun.jvm.hotspot.HotSpotTypeDataBase.lookupType(HotSpotTypeDataBase.java:134)\n\tat sun.jvm.hotspot.HotSpotTypeDataBase.lookupOrCreateClass(HotSpotTypeDataBase.java:631)\n\tat sun.jvm.hotspot.HotSpotTypeDataBase.createType(HotSpotTypeDataBase.java:751)\n\tat sun.jvm.hotspot.HotSpotTypeDataBase.readVMTypes(HotSpotTypeDataBase.java:195)\n\tat sun.jvm.hotspot.HotSpotTypeDataBase.\u003cinit\u003e(HotSpotTypeDataBase.java:89)\n\tat sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:403)\n\tat sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:305)\n\tat sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140)\n\tat sun.jvm.hotspot.tools.Tool.start(Tool.java:185)\n\tat sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)\n\tat sun.jvm.hotspot.tools.jcore.ClassDump.main(ClassDump.java:180)\n\t... 5 more\n```\n\n* One class loaded by multi ClassLoader\n\nTry to use HSDB. After attach java process, \"Tools\", \"Class Browser\".\n\n```bash\nsudo java -classpath \"$JAVA_HOME/lib/sa-jdi.jar\" sun.jvm.hotspot.HSDB\n```\n\n### complie dumpclass.jar\n\n```bash\nmvn clean package\nls -alh target\n```\n\n## License\n\nApache License V2\n","funding_links":[],"categories":["Java"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhengyunabc%2Fdumpclass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhengyunabc%2Fdumpclass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhengyunabc%2Fdumpclass/lists"}