{"id":19762601,"url":"https://github.com/majianzheng/jarboot","last_synced_at":"2025-04-05T14:03:04.023Z","repository":{"id":44593057,"uuid":"228128942","full_name":"majianzheng/jarboot","owner":"majianzheng","description":"A powerful Java process starter and debugging-tools that manage monitor and debug local and remote Java instance online.","archived":false,"fork":false,"pushed_at":"2024-04-03T01:44:52.000Z","size":15297,"stargazers_count":278,"open_issues_count":1,"forks_count":60,"subscribers_count":10,"default_branch":"develop","last_synced_at":"2024-04-03T02:51:45.075Z","etag":null,"topics":["debugging-tools","jar","java","monitoring-tool","starter"],"latest_commit_sha":null,"homepage":"https://www.yuque.com/jarboot/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/majianzheng.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-12-15T04:35:56.000Z","updated_at":"2024-05-27T11:34:23.892Z","dependencies_parsed_at":"2024-04-03T02:46:13.540Z","dependency_job_id":"79351949-dd6c-4b72-b265-b75ed80eeb9a","html_url":"https://github.com/majianzheng/jarboot","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/majianzheng%2Fjarboot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/majianzheng%2Fjarboot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/majianzheng%2Fjarboot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/majianzheng%2Fjarboot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/majianzheng","download_url":"https://codeload.github.com/majianzheng/jarboot/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345848,"owners_count":20924102,"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":["debugging-tools","jar","java","monitoring-tool","starter"],"created_at":"2024-11-12T04:05:20.933Z","updated_at":"2025-04-05T14:03:04.002Z","avatar_url":"https://github.com/majianzheng.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jarboot ❤️\n\n![logo](https://gitee.com/majz0908/jarboot/raw/develop/doc/jarboot.png)\n\n[![CodeQL](https://github.com/majianzheng/jarboot/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/majianzheng/jarboot/actions/workflows/codeql-analysis.yml)\n![Maven Central](https://img.shields.io/maven-central/v/io.github.majianzheng/jarboot-all)\n[![Build Status](https://travis-ci.com/majianzheng/jarboot.svg?branch=master)](https://travis-ci.com/majianzheng/jarboot)\n[![codecov](https://codecov.io/gh/majianzheng/jarboot/branch/master/graph/badge.svg?token=FP7EPSFH4E)](https://codecov.io/gh/majianzheng/jarboot)\n![GitHub](https://img.shields.io/github/license/majianzheng/jarboot)\n[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/majianzheng/jarboot.svg)](http://isitmaintained.com/project/majianzheng/jarboot \"Average time to resolve an issue\")\n[![Percentage of issues still open](http://isitmaintained.com/badge/open/majianzheng/jarboot.svg)](http://isitmaintained.com/project/majianzheng/jarboot \"Percentage of issues still open\")\n[![语雀](https://img.shields.io/badge/%E8%AF%AD%E9%9B%80-%E6%96%87%E6%A1%A3%E7%A4%BE%E5%8C%BA-brightgreen.svg)](https://www.yuque.com/jarboot/usage/quick-start)\n![Docker Pulls](https://img.shields.io/docker/pulls/mazheng0908/jarboot)\n\n\u003ccode\u003eJarboot\u003c/code\u003e is a platform for Java process startup, shutdown, management and diagnosis. It can manage, guard, monitor and diagnose local and remote Java processes.\n\nIn the test environment and daily built integrated environment, a series of jar files such as compilation output can be put into the agreed directory. \u003ccode\u003eJarboot\u003c/code\u003e provides a friendly browser UI interface and HTTP interface to manage its start, stop and status monitoring, and execute commands to debug the target process.\n\n[中文说明/Chinese Documentation](README_CN.md)\n\n📚 Document: https://www.yuque.com/jarboot\n\n🍏 Best practices 🔥 : [Jarboot with Spring Cloud Alibaba Example](https://github.com/majianzheng/jarboot-with-spring-cloud-alibaba-example) ⭐️ \n\n🐳 Extensible: Support both \u003ccode\u003eJDK SPI\u003c/code\u003e and \u003ccode\u003eSpring SPI\u003c/code\u003e, support plugins develop.\n\n📦 Installation package Download: [https://gitee.com/majz0908/jarboot/releases](https://gitee.com/majz0908/jarboot/releases)\n\n📺 视频演示： [哔哩哔哩视频](https://www.bilibili.com/video/BV1KG411e7ip/?share_source=copy_web\u0026vd_source=b901b6d8d17d4922a1229758fa74e46c)\n\n![overview](https://gitee.com/majz0908/jarboot/raw/develop/doc/overview.png)\n\n## Background and objectives\n\u003ccode\u003eJarboot\u003c/code\u003e uses Java agent and \u003ccode\u003eASM\u003c/code\u003e technology to inject code into the target java process, \nwhich is non-invasive. The injected code is only used for command interaction with jarboot's service. Some commands \nmodify the bytecode of the class for class enhancement. A command system similar to \u003ccode\u003eArthas\u003c/code\u003e is added, such \nas acquiring JVM information, monitoring thread status, acquiring thread stack information, etc.\n\n- 🌈   Browser interface management, one click start, stop, do not have to manually execute one by one.\n- 🔥   Support start and stop priority configuration\u003csup id=\"a2\"\u003e[[1]](#f1)\u003c/sup\u003e, and default parallel start.\n- ⭐   Process daemon. If the service exits abnormally after opening, it will be automatically started and notified.\n- ☀️   Support file update monitoring, and restart automatically if jar file is updated after opening.\u003csup id=\"a3\"\u003e[[2]](#f2)\u003c/sup\u003e\n- 🚀   Debug command execution, remote debugging multiple Java processes at the same time, the interface is more friendly.\n- 💎   Support user-define command by \u003ccode\u003eSPI\u003c/code\u003e, support develop plugins.\n\n![online diagnose](https://gitee.com/majz0908/jarboot/raw/develop/doc/online-diagnose.png)\n\n### Architecture brief introduction\nDetailed architecture design [view](jarboot-server/README.md)\n\nFront-end interface adopts \u003ccode\u003eVue3\u003c/code\u003e technology. The back-end service is mainly implemented by \u003ccode\u003eSpringBoot\u003c/code\u003e, which provides HTTP interface and static resource broker. The process information is pushed through \u003ccode\u003ewebsocket\u003c/code\u003e to the front-end interface in real time, and a long connection is maintained with the started java process to monitor its status.\n\nChrome \u003e=87\nFirefox \u003e=78\nSafari \u003e=14\nEdge \u003e=88\n\n## Install or build\n### Download the zip package to install or using docker.\n- \u003ca href=\"https://github.com/majianzheng/jarboot/releases\" target=\"_blank\"\u003eDownload from Github\u003c/a\u003e\n\nUse \u003ccode\u003edocker\u003c/code\u003e\n```bash\n# Docker image build\nmvn clean install -P prod\nsh build/docker-push.sh\n\n# Start container\nsudo docker run -itd --name jarboot -p 9899:9899 mazheng0908/jarboot\n```\n\n### Code build method\nIgnore this when using zip package or \u003ccode\u003edocker\u003c/code\u003e.\n\nBuild the jarboot code.\n```bash\n#At first prepare JDK17+ and nodeJs16+, then\n$ mvn clean install -P prod\n```\n### Start \u003ccode\u003ejarboot\u003c/code\u003e server\nIgnore this when using \u003ccode\u003edocker\u003c/code\u003e.\n```bash\n#Execute startup.sh to start, use startup.cmd when in windows OS.\n$ sh startup.sh\n```\n\n### Browser access \u003chttp://127.0.0.1:9899\u003e\nEnter the login page. Initial username: \u003ccode\u003ejarboot\u003c/code\u003e, default password: \u003ccode\u003ejarboot\u003c/code\u003e\n\n## SPI Extension, support both JDK and Spring SPI\nUse SPI extension can implement your own command, define a command how to execute. And，also can notify stated event to Jarboot server\n, don't need to wait no console time.\n### SpringBoot Application\n1. Import \u003ccode\u003espring-boot-starter-jarboot\u003c/code\u003e dependency\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.majianzheng\u003c/groupId\u003e\n    \u003cartifactId\u003espring-boot-starter-jarboot\u003c/artifactId\u003e\n    \u003cversion\u003e${jarboot.version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n2. Implement \u003ccode\u003eCommandProcessor\u003c/code\u003eSPI interface\n\nAlso, you can use \u003ccode\u003e@Bean\u003c/code\u003e in the method.\u003cbr\u003e\nIt will use bean name as the command name if not annotated by \u003ccode\u003e@Name\u003c/code\u003e.\n```java\n@Name(\"spring.command.name\")\n@Summary(\"The command summary\")\n@Description(\"The command usage detail\")\n@Component\npublic class DemoServiceImpl implements DemoService, CommandProcessor {\n  @Override\n  public String process(CommandSession session, String[] args) {\n      return \"Spring boot Demo user-defined command using Spring SPI\";\n  }\n  //implement other method...\n}\n```\nIt will add two new spring debug command \u003ccode\u003espring.bean\u003c/code\u003e and \u003ccode\u003espring.env\u003c/code\u003e after imported \n\u003ccode\u003espring-boot-starter-jarboot\u003c/code\u003e dependence.\n```shell\n#spring.bean usage:\n$ spring.bean [-b \u003cname\u003e] [-d]\n#Examples:\n# Get all bean names\n$ spring.bean\n# Get bean info\n$ spring.bean -b beanName\n# Get bean detail definition\n$ spring.bean -b beanName -d\n\n#sping.env usage:\n$ spring.env \u003cname\u003e\n#Examples:\n$ spring.env spring.application.name\n```\n\n### None SpringBoot Application\nDemonstrate how to use ordinary non springboot applications.\n#### How to create user-defined command\n1. Import jarboot api dependency\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.majianzheng\u003c/groupId\u003e\n    \u003cartifactId\u003ejarboot-api\u003c/artifactId\u003e\n    \u003cscope\u003eprovided\u003c/scope\u003e\n    \u003cversion\u003e${jarboot.version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n2. Implement spi interface\n```java\n/**\n * Use Name to define the command name\n */\n@Name(\"demo\")\n@Summary(\"The command summary\")\n@Description(\"The command usage detail\")\npublic class DemoCommandProcessor implements CommandProcessor {\n    @Override\n    public String process(CommandSession session, String[] args) {\n        return \"demo SPI command result.\";\n    }\n}\n```\n3. Create spi define file\n\nThen create a file in \u003ccode\u003eresources\u003c/code\u003e/\u003ccode\u003eMETA-INF\u003c/code\u003e/\u003ccode\u003eservices\u003c/code\u003e named \n \u003ccode\u003espi.cmd.io.github.majianzheng.jarboot.api.CommandProcessor\u003c/code\u003e the content is class full name.\n\n#### Proactive notification of startup completion\n```java\npublic class DemoApplication {\n    public static void main(String[] args) {\n        // do something\n        try {\n            //Notify completion\n            JarbootFactory.createAgentService().setStarted();\n        } catch (Exception e) {\n            log(e.getMessage());\n        }\n    }\n}\n```\n\n## Tools\n### File browse\n![file_browse](https://gitee.com/majz0908/jarboot/raw/develop/doc/file-browse.png)\n\n### Terminal\n![terminal](https://gitee.com/majz0908/jarboot/raw/develop/doc/terminal.png)\n\n\n## Command list\n### bytes\nView the class bytes，Usage：\n\n```bash\njarboot$ bytes io.github.majianzheng.jarboot.demo.DemoServerApplication\nClassLoader: org.springframework.boot.loader.LaunchedURLClassLoader@31221be2\n------\ngetUser\nL0\nLINENUMBER 27 L0\n\n...\n\nILOAD 1\nILOAD 2\nIADD\nIRETURN\nL8\n```\n\n### stdout\nTurn on or off real-time display of standard output stream (initially on), it will be displayed on the front-end UI of \nthe web in real time. The output stream includes \u003ccode\u003eSystem.out.println\u003c/code\u003e, \u003ccode\u003eSystem.err.println\u003c/code\u003e and \nlog printing information such as \u003ccode\u003elogger.info(\"hello\")\u003c/code\u003e in the code.\n\nNote: The implementation mechanism of this function has been carefully designed. It is recommended to be turned on all \n the time, which has no impact on performance and can be accelerated when starting.\n```bash\n#Turn on real time display of standard output stream\njarboot$ stdout on\n\n#Turn off real time display of standard output stream\njarboot$ stdout off\n\n#Get current status on or off\njarboot$ stdout\n```\n\n### dashboard\nThis is the real time statistics dashboard for the current system，click x cancel.\n\n![dashboard](https://gitee.com/majz0908/jarboot/raw/develop/doc/dashboard.png)\n  \n### jad\nDecompile the specified classes.\n\n```bash\njarboot$ jad [-c] java.lang.String\n````\n![jad](https://gitee.com/majz0908/jarboot/raw/develop/doc/jad.png)\n\n### jvm\nCheck the current JVM’s info\n\n```bash\njarboot$ jvm\n````\n\n### sc\nSearch any loaded class with detailed information.\n\n```bash\n$ sc -d org.springframework.web.context.support.XmlWebApplicationContext\n class-info        org.springframework.web.context.support.XmlWebApplicationContext\n code-source       /Users/xxx/work/test/WEB-INF/lib/spring-web-3.2.11.RELEASE.jar\n name              org.springframework.web.context.support.XmlWebApplicationContext\n isInterface       false\n isAnnotation      false\n isEnum            false\n isAnonymousClass  false\n isArray           false\n isLocalClass      false\n isMemberClass     false\n isPrimitive       false\n isSynthetic       false\n simple-name       XmlWebApplicationContext\n modifier          public\n annotation\n interfaces\n super-class       +-org.springframework.web.context.support.AbstractRefreshableWebApplicationContext\n                     +-org.springframework.context.support.AbstractRefreshableConfigApplicationContext\n                       +-org.springframework.context.support.AbstractRefreshableApplicationContext\n                         +-org.springframework.context.support.AbstractApplicationContext\n                           +-org.springframework.core.io.DefaultResourceLoader\n                             +-java.lang.Object\n class-loader      +-org.apache.catalina.loader.ParallelWebappClassLoader\n                     +-java.net.URLClassLoader@6108b2d7\n                       +-sun.misc.Launcher$AppClassLoader@18b4aac2\n                         +-sun.misc.Launcher$ExtClassLoader@1ddf84b8\n classLoaderHash   25131501\n\n````\n\n  \n### trace\nmethod calling path, and output the time cost for each node in the path.\n\n```bash\njarboot$ trace io.github.majianzheng.jarboot.demo.DemoServerApplication add \nAffect(class count: 2 , method count: 1) cost in 63 ms, listenerId: 2\n`---ts=2021-06-15 23:34:20;thread_name=http-nio-9900-exec-3;id=13;is_daemon=true;priority=5;TCCL=org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader@4690b489\n    `---[0.053485ms] io.github.majianzheng.jarboot.demo.DemoServerApplication:add()\n```\n  \n### watch\nmethods in data aspect including return values, exceptions and parameters\n    \nWatch the first parameter and thrown exception of `io.github.majianzheng.jarboot.demo.DemoServerApplicatio#add` only if it throws exception.\n\n```bash\njarboot$ watch io.github.majianzheng.jarboot.demo.DemoServerApplicatio add {params[0], throwExp} -e\nPress x to abort.\nAffect(class-cnt:1 , method-cnt:1) cost in 65 ms.\nts=2018-09-18 10:26:28;result=@ArrayList[\n    @RequestFacade[org.apache.catalina.connector.RequestFacade@79f922b2],\n    @NullPointerException[java.lang.NullPointerException],\n]\n```\n  \n### thread\nCheck the basic info and stack trace of the target thread.\n\n```bash\njarboot$ thread -n 3\n\"nioEventLoopGroup-2-1\" Id=31 cpuUsage=0.37% deltaTime=0ms time=880ms RUNNABLE\n    at sun.management.ThreadImpl.dumpThreads0(Native Method)\n    at sun.management.ThreadImpl.getThreadInfo(ThreadImpl.java:448)\n    at impl.cmd.io.github.majianzheng.jarboot.core.ThreadCommand.processTopBusyThreads(ThreadCommand.java:209)\n    at impl.cmd.io.github.majianzheng.jarboot.core.ThreadCommand.run(ThreadCommand.java:120)\n    at basic.io.github.majianzheng.jarboot.core.EnvironmentContext.runCommand(EnvironmentContext.java:162)\n    at cmd.io.github.majianzheng.jarboot.core.CommandRequestSubscriber.execute(CommandDispatcher.java:35)\n    at server.io.github.majianzheng.jarboot.core.JarbootBootstrap$1.onText(JarbootBootstrap.java:94)\n    at io.github.majianzheng.jarboot.core.ws.WebSocketClientHandler.channelRead0(WebSocketClientHandler.java:83)\n    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)\n\n\"C2 CompilerThread1\" [Internal] cpuUsage=3.14% deltaTime=6ms time=4599ms\n\n\n\"C2 CompilerThread0\" [Internal] cpuUsage=2.28% deltaTime=4ms time=4692ms\n```\n\n#### Classloader\n\nView the class loader extends tree, url and class loader info.\n\n```bash\njarboot$ classloader\nname\t                                                numberOfInstances\tloadedCountTotal\norg.springframework.boot.loader.LaunchedURLClassLoader\t1\t                3929\nBootstrapClassLoader\t                                1                \t2623\nio.github.majianzheng.jarboot.agent.JarbootClassLoader             \t1               \t1780\nsun.misc.Launcher$AppClassLoader                    \t1               \t59\nsun.reflect.DelegatingClassLoader                 \t58                \t58\nsun.misc.Launcher$ExtClassLoader                     \t1\t                18\nAffect(row-cnt:6) cost in 35 ms.\n```\n\n### heapdump\ndump java heap in hprof binary format, like jmap.\n\n```bash\njarboot$ heapdump\n````\n![heap dump](https://gitee.com/majz0908/jarboot/raw/develop/doc/heapdump.png)\n\n### sysprop\nExamine the system properties from the target JVM\n\n```bash\n#Get all.\njarboot$ sysprop\n#Get one property.\njarboot$ sysprop user.home\n```\n\n\n---\n## Credit\n### Projects\n\n* [bytekit](https://github.com/alibaba/bytekit) Java Bytecode Kit.\n* [Arthas](https://github.com/alibaba/arthas) Some command is developed on the source of \u003ccode\u003eArthas\u003c/code\u003e.\n\n## Thanks\nWe used JetBrains tools for developing and building.\n\n![JetBrains Logo (Main) logo](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)\n## Contact\n- Mail: 282295811@qq.com\n- QQ group: 663881845\n- QQ群已满，微信群二维码会过期，大家关注下抖音吧，关注后加入抖音的粉丝群\n- 抖音号：1077242754\n\n![抖音](https://gitee.com/majz0908/jarboot/raw/develop/doc/douyin.png)\n![投喂](https://gitee.com/majz0908/jarboot/raw/develop/doc/touwei.png)\n\n## 仓库镜像\n\n* [码云Jarboot](https://gitee.com/majz0908/jarboot)\n\n---\n\u003cspan id=\"f1\"\u003e1[](#a1)\u003c/span\u003e: You can configure the priority level, starting from the integer value of 1. The more you start first, the reverse is the order of stop.\u003cbr\u003e\n\u003cspan id=\"f2\"\u003e2[](#a2)\u003c/span\u003e: In development, it can be built automatically by tools such as gitlab runner, Jenkins, etc. and copied to the directory specified by Jarboot through script. Updates monitored by Jarboot will restart the service automatically. Directory monitoring implements anti-shake design (multiple updates within a certain period of time will trigger only one restart).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmajianzheng%2Fjarboot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmajianzheng%2Fjarboot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmajianzheng%2Fjarboot/lists"}