WangJi92 / arthas-idea-plugin

arthas idea plugin 更简单的使用arthas的IDEA 插件,方便的构建各种arthas 命令,复制到剪切板 然后到服务器上启动arthas 执行命令。
https://plugins.jetbrains.com/plugin/13581-arthas-idea
Apache License 2.0
607 stars 98 forks source link

arthas 4.x get spring all propertys null #158

Closed WangJi92 closed 2 hours ago

WangJi92 commented 2 hours ago

[arthas@56714]$ ognl -x 3 '#springContext=@com.wangji92.arthas.plugin.demo.common.ApplicationContextProvider@context,#standardServletEnvironment=#springContext.getEnvironment(),+#allProperties={},#propertySourceIterator=#standardServletEnvironment.getPropertySources().iterator(),#propertySourceIterator.{#key=#this.getName(),#allProperties.add(" "),#allProperties.add("------------------------- name:"+#key),#this.getSource() instanceof java.util.Map ?#this.getSource().entrySet().iterator.{#key=#this.key,#allProperties.add(#key+"="+#standardServletEnvironment.getProperty(#key))}:#{}},#allProperties' -c 102aa497 @ArrayList[ @String[ ], @String[------------------------- name:server.ports], @String[local.server.port=null], @String[ ], @String[------------------------- name:configurationProperties], @String[ ], @String[------------------------- name:customFirst], @String[custom.name=null], @String[ ], @String[------------------------- name:servletConfigInitParams], @String[ ], @String[------------------------- name:servletContextInitParams], @String[ ], @String[------------------------- name:systemProperties], @String[java.runtime.name=null], @String[sun.boot.library.path=null], @String[java.vm.version=null], @String[gopherProxySet=null], @String[java.vm.vendor=null], @String[java.vendor.url=null], @String[path.separator=null], @String[java.vm.name=null], @String[file.encoding.pkg=null], @String[user.country=null], @String[sun.java.launcher=null], @String[sun.os.patch.level=null], @String[PID=null], @String[java.vm.specification.name=null], @String[user.dir=null], @String[intellij.debug.agent=null], @String[java.runtime.version=null], @String[java.awt.graphicsenv=null], @String[java.endorsed.dirs=null], @String[os.arch=null], @String[java.io.tmpdir=null], @String[line.separator=null], @String[java.vm.specification.vendor=null], @String[os.name=null], @String[sun.jnu.encoding=null], @String[spring.beaninfo.ignore=null], @String[java.library.path=null], @String[jboss.modules.system.pkgs=null], @String[java.specification.name=null], @String[java.class.version=null], @String[sun.management.compiler=null], @String[os.version=null], @String[user.home=null], @String[catalina.useNaming=null], @String[user.timezone=null], @String[java.awt.printerjob=null], @String[file.encoding=null], @String[java.specification.version=null], @String[catalina.home=null], @String[java.class.path=null], @String[user.name=null], @String[java.vm.specification.version=null], @String[sun.java.command=null], @String[java.home=null], @String[sun.arch.data.model=null], @String[user.language=null], @String[java.specification.vendor=null], @String[awt.toolkit=null], @String[java.vm.info=null], @String[java.version=null], @String[java.ext.dirs=null], @String[sun.boot.class.path=null], @String[java.awt.headless=null], @String[java.vendor=null], @String[catalina.base=null], @String[com.zaxxer.hikari.pool_number=null], @String[file.separator=null], @String[java.vendor.url.bug=null], @String[sun.io.unicode.encoding=null], @String[sun.cpu.endian=null], @String[sun.cpu.isalist=null], @String[ ], @String[------------------------- name:systemEnvironment], @String[PATH=null], @String[DATAGRIP_VM_OPTIONS=null], @String[WEBSTORM_VM_OPTIONS=null], @String[PYCHARM_VM_OPTIONS=null], @String[JAVA_HOME=null], @String[CLION_VM_OPTIONS=null], @String[JETBRAINSCLIENT_VM_OPTIONS=null], @String[LDFLAGS=null], @String[GATEWAY_VM_OPTIONS=null], @String[COMMAND_MODE=null], @String[GOLAND_VM_OPTIONS=null], @String[RIDER_VM_OPTIONS=null], @String[IDEA_VM_OPTIONS=null], @String[RUBYMINE_VM_OPTIONS=null], @String[LOGNAME=null], @String[DEVECOSTUDIO_VM_OPTIONS=null], @String[JETBRAINS_CLIENT_VM_OPTIONS=null], @String[PWD=null], @String[XPC_SERVICE_NAME=null], @String[STUDIO_VM_OPTIONS=null], @String[CFBundleIdentifier=null], @String[HOMEBREW_GITHUB_API_TOKEN=null], @String[SHELL=null], @String[APPCODE_VM_OPTIONS=null], @String[CPPFLAGS=null], @String[PAGER=null], @String[LSCOLORS=null], @String[GOPATH=null], @String[OLDPWD=null], @String[USER=null], @String[GOROOT=null], @String[ZSH=null], @String[TMPDIR=null], @String[DATASPELL_VM_OPTIONS=null], @String[SSH_AUTH_SOCK=null], @String[JAVA_MAIN_CLASS_56714=null], @String[XPC_FLAGS=null], @String[WEBIDE_VM_OPTIONS=null], @String[M2_HOME=null], @String[CF_USER_TEXT_ENCODING=null], @String[LESS=null], @String[PHPSTORM_VM_OPTIONS=null], @String[LC_CTYPE=null], @String[IDEA_INITIAL_DIRECTORY=null], @String[HOME=null], @String[ ], @String[------------------------- name:random], @String[ ], @String[------------------------- name:applicationConfig: [classpath:/application.properties]], @String[server.port=null], @String[spring.datasource.url=null], @String[spring.datasource.driver-class-name=null], @String[spring.datasource.username=null], @String[spring.datasource.password=null], @String[spring.h2.console.settings.web-allow-others=null], @String[spring.h2.console.path=null], @String[spring.h2.console.enabled=null], @String[spring.datasource.schema=null], @String[spring.datasource.data=null], @String[logging.level.root=null], @String[logging.level.com.wangji92.arthas.plugin.demo.mapper.CityMapper=null], @String[ognl=null], @String[vmtool=null], @String[ ], @String[------------------------- name:customLast], @String[custom.name=null], @String[ ], @String[------------------------- name:devtools], @String[spring.resources.cache.period=null], @String[spring.groovy.template.cache=null], @String[server.servlet.jsp.init-parameters.development=null], @String[spring.mvc.log-resolved-exception=null], @String[spring.thymeleaf.cache=null], @String[spring.freemarker.cache=null], @String[server.error.include-stacktrace=null], @String[spring.reactor.debug=null], @String[spring.mustache.cache=null], @String[spring.h2.console.enabled=null], @String[server.servlet.session.persistent=null], @String[spring.template.provider.cache=null], @String[spring.resources.chain.cache=null], ] [arthas@56714]$ version 4.0.3 [arthas@56714]$

WangJi92 commented 2 hours ago

3.x 正常 [arthas@56714]$ ognl -x 3 '#springContext=@com.wangji92.arthas.plugin.demo.common.ApplicationContextProvider@context,#standardServletEnvironment=#springContext.getEnvironment(),+#allProperties={},#propertySourceIterator=#standardServletEnvironment.getPropertySources().iterator(),#propertySourceIterator.{#key=#this.getName(),#allProperties.add(" "),#allProperties.add("------------------------- name:"+#key),#this.getSource() instanceof java.util.Map ?#this.getSource().entrySet().iterator.{#key=#this.key,#allProperties.add(#key+"="+#standardServletEnvironment.getProperty(#key))}:#{}},#allProperties' -c 102aa497 @ArrayList[ @String[ ], @String[------------------------- name:server.ports], @String[local.server.port=9092], @String[ ], @String[------------------------- name:configurationProperties], @String[ ], @String[------------------------- name:customFirst], @String[custom.name=Custom Environment first Name], @String[ ], @String[------------------------- name:servletConfigInitParams], @String[ ], @String[------------------------- name:servletContextInitParams], @String[ ], @String[------------------------- name:systemProperties], @String[java.runtime.name=Java(TM) SE Runtime Environment], @String[sun.boot.library.path=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib], @String[java.vm.version=25.181-b13], @String[gopherProxySet=false], @String[java.vm.vendor=Oracle Corporation], @String[java.vendor.url=http://java.oracle.com/], @String[path.separator=:], @String[java.vm.name=Java HotSpot(TM) 64-Bit Server VM], @String[file.encoding.pkg=sun.io], @String[user.country=CN], @String[sun.java.launcher=SUN_STANDARD], @String[sun.os.patch.level=unknown], @String[PID=56714], @String[java.vm.specification.name=Java Virtual Machine Specification], @String[user.dir=/Users/wangji/Documents/project/arthas-plugin-demo], @String[intellij.debug.agent=true], @String[java.runtime.version=1.8.0_181-b13], @String[java.awt.graphicsenv=sun.awt.CGraphicsEnvironment], @String[java.endorsed.dirs=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/endorsed], @String[os.arch=x86_64], @String[java.io.tmpdir=/var/folders/mf/7_3y5nms03g796jygh3ky7_c0000gn/T/], @String[line.separator=\n], @String[java.vm.specification.vendor=Oracle Corporation], @String[os.name=Mac OS X], @String[sun.jnu.encoding=UTF-8], @String[spring.beaninfo.ignore=true], @String[java.library.path=/Users/wangji/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.], @String[jboss.modules.system.pkgs=com.intellij.rt], @String[java.specification.name=Java Platform API Specification], @String[java.class.version=52.0], @String[sun.management.compiler=HotSpot 64-Bit Tiered Compilers], @String[os.version=10.16], @String[user.home=/Users/wangji], @String[catalina.useNaming=false], @String[user.timezone=Asia/Shanghai], @String[java.awt.printerjob=sun.lwawt.macosx.CPrinterJob], @String[file.encoding=UTF-8], @String[java.specification.version=1.8], @String[catalina.home=/private/var/folders/mf/7_3y5nms03g796jygh3ky7_c0000gn/T/tomcat.5472685741617168028.9092], @String[java.class.path=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/tools.jar:/Users/wangji/Documents/project/arthas-plugin-demo/target/classes:/Users/wangji/.m2/repository/com/alibaba/fastjson/1.2.83/fastjson-1.2.83.jar:/Users/wangji/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.2.5.RELEASE/spring-boot-starter-web-2.2.5.RELEASE.jar:/Users/wangji/.m2/repository/org/springframework/boot/spring-boot-starter/2.2.5.RELEASE/spring-boot-starter-2.2.5.RELEASE.jar:/Users/wangji/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.2.5.RELEASE/spring-boot-starter-logging-2.2.5.RELEASE.jar:/Users/wangji/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/wangji/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/wangji/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.12.1/log4j-to-slf4j-2.12.1.jar:/Users/wangji/.m2/repository/org/apache/logging/log4j/log4j-api/2.12.1/log4j-api-2.12.1.jar:/Users/wangji/.m2/repository/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar:/Users/wangji/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/Users/wangji/.m2/repository/org/yaml/snakeyaml/1.25/snakeyaml-1.25.jar:/Users/wangji/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.2.5.RELEASE/spring-boot-starter-json-2.2.5.RELEASE.jar:/Users/wangji/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.10.2/jackson-databind-2.10.2.jar:/Users/wangji/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.10.2/jackson-annotations-2.10.2.jar:/Users/wangji/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.10.2/jackson-core-2.10.2.jar:/Users/wangji/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.10.2/jackson-datatype-jdk8-2.10.2.jar:/Users/wangji/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.10.2/jackson-datatype-jsr310-2.10.2.jar:/Users/wangji/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.10.2/jackson-module-parameter-names-2.10.2.jar:/Users/wangji/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.2.5.RELEASE/spring-boot-starter-tomcat-2.2.5.RELEASE.jar:/Users/wangji/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.31/tomcat-embed-core-9.0.31.jar:/Users/wangji/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.31/tomcat-embed-el-9.0.31.jar:/Users/wangji/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.31/tomcat-embed-websocket-9.0.31.jar:/Users/wangji/.m2/repository/org/springframework/boot/spring-boot-starter-validation/2.2.5.RELEASE/spring-boot-starter-validation-2.2.5.RELEASE.jar:/Users/wangji/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/Users/wangji/.m2/repository/org/hibernate/validator/hibernate-validator/6.0.18.Final/hibernate-validator-6.0.18.Final.jar:/Users/wangji/.m2/repository/org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar:/Users/wangji/.m2/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar:/Users/wangji/.m2/repository/org/springframework/spring-web/5.2.4.RELEASE/spring-web-5.2.4.RELEASE.jar:/Users/wangji/.m2/repository/org/springframework/spring-webmvc/5.2.4.RELEASE/spring-webmvc-5.2.4.RELEASE.jar:/Users/wangji/.m2/repository/org/springframework/spring-aop/5.2.4.RELEASE/spring-aop-5.2.4.RELEASE.jar:/Users/wangji/.m2/repository/org/springframework/spring-context/5.2.4.RELEASE/spring-context-5.2.4.RELEASE.jar:/Users/wangji/.m2/repository/org/springframework/spring-expression/5.2.4.RELEASE/spring-expression-5.2.4.RELEASE.jar:/Users/wangji/.m2/repository/org/mybatis/spring/boot/mybatis-spring-boot-starter/2.1.2/mybatis-spring-boot-starter-2.1.2.jar:/Users/wangji/.m2/repository/org/mybatis/spring/boot/mybatis-spring-boot-autoconfigure/2.1.2/mybatis-spring-boot-autoconfigure-2.1.2.jar:/Users/wangji/.m2/repository/org/mybatis/mybatis/3.5.4/mybatis-3.5.4.jar:/Users/wangji/.m2/repository/org/mybatis/mybatis-spring/2.0.4/mybatis-spring-2.0.4.jar:/Users/wangji/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/2.2.5.RELEASE/spring-boot-starter-jdbc-2.2.5.RELEASE.jar:/Users/wangji/.m2/repository/com/zaxxer/HikariCP/3.4.2/HikariCP-3.4.2.jar:/Users/wangji/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/Users/wangji/.m2/repository/org/springframework/spring-jdbc/5.2.4.RELEASE/spring-jdbc-5.2.4.RELEASE.jar:/Users/wangji/.m2/repository/org/springframework/boot/spring-boot-devtools/2.2.5.RELEASE/spring-boot-devtools-2.2.5.RELEASE.jar:/Users/wangji/.m2/repository/org/springframework/boot/spring-boot/2.2.5.RELEASE/spring-boot-2.2.5.RELEASE.jar:/Users/wangji/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.2.5.RELEASE/spring-boot-autoconfigure-2.2.5.RELEASE.jar:/Users/wangji/.m2/repository/org/springframework/boot/spring-boot-configuration-processor/2.2.5.RELEASE/spring-boot-configuration-processor-2.2.5.RELEASE.jar:/Users/wangji/.m2/repository/org/projectlombok/lombok/1.18.12/lombok-1.18.12.jar:/Users/wangji/.m2/repository/org/springframework/spring-core/5.2.4.RELEASE/spring-core-5.2.4.RELEASE.jar:/Users/wangji/.m2/repository/org/springframework/spring-jcl/5.2.4.RELEASE/spring-jcl-5.2.4.RELEASE.jar:/Users/wangji/.m2/repository/org/springframework/spring-tx/5.2.4.RELEASE/spring-tx-5.2.4.RELEASE.jar:/Users/wangji/.m2/repository/org/springframework/spring-beans/5.2.4.RELEASE/spring-beans-5.2.4.RELEASE.jar:/Users/wangji/.m2/repository/com/h2database/h2/1.4.200/h2-1.4.200.jar:/Applications/IntelliJ IDEA 2024.app/Contents/lib/idea_rt.jar:/Users/wangji/Library/Caches/JetBrains/IntelliJIdea2024.1/captureAgent/debugger-agent.jar], @String[user.name=wangji], @String[java.vm.specification.version=1.8], @String[sun.java.command=com.wangji92.arthas.plugin.demo.ArthasPluginDemoApplication], @String[java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre], @String[sun.arch.data.model=64], @String[user.language=zh], @String[java.specification.vendor=Oracle Corporation], @String[awt.toolkit=sun.lwawt.macosx.LWCToolkit], @String[java.vm.info=mixed mode], @String[java.version=1.8.0_181], @String[java.ext.dirs=/Users/wangji/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java], @String[sun.boot.class.path=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/classes:/Users/wangji/Library/Caches/JetBrains/IntelliJIdea2024.1/captureAgent/debugger-agent.jar], @String[java.awt.headless=true], @String[java.vendor=Oracle Corporation], @String[catalina.base=/private/var/folders/mf/7_3y5nms03g796jygh3ky7_c0000gn/T/tomcat.5472685741617168028.9092], @String[com.zaxxer.hikari.pool_number=1], @String[file.separator=/], @String[java.vendor.url.bug=http://bugreport.sun.com/bugreport/], @String[sun.io.unicode.encoding=UnicodeBig], @String[sun.cpu.endian=little], @String[sun.cpu.isalist=], @String[ ], @String[------------------------- name:systemEnvironment], @String[PATH=/usr/local/opt/sqlite/bin:/usr/local/opt/mysql@5.7/bin:/Users/wangji/Documents/dev/maven/apache-maven-3.6.1/bin:/usr/local/opt/redis@4.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/go/bin:/Users/wangji/go/bin], @String[DATAGRIP_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/datagrip.vmoptions], @String[WEBSTORM_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/webstorm.vmoptions], @String[PYCHARM_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/pycharm.vmoptions], @String[JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/], @String[CLION_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/clion.vmoptions], @String[JETBRAINSCLIENT_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/jetbrainsclient.vmoptions], @String[LDFLAGS=-L/usr/local/opt/mysql@5.7/lib], @String[GATEWAY_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/gateway.vmoptions], @String[COMMAND_MODE=unix2003], @String[GOLAND_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/goland.vmoptions], @String[RIDER_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/rider.vmoptions], @String[IDEA_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/idea.vmoptions], @String[RUBYMINE_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/rubymine.vmoptions], @String[LOGNAME=wangji], @String[DEVECOSTUDIO_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/devecostudio.vmoptions], @String[JETBRAINS_CLIENT_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/jetbrains_client.vmoptions], @String[PWD=/Users/wangji/Documents/project/arthas-plugin-demo], @String[XPC_SERVICE_NAME=application.com.jetbrains.intellij.19742396.19743206], @String[STUDIO_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/studio.vmoptions], @String[CFBundleIdentifier=com.jetbrains.intellij], @String[HOMEBREW_GITHUB_API_TOKEN=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], @String[SHELL=/bin/zsh], @String[APPCODE_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/appcode.vmoptions], @String[CPPFLAGS=-I/usr/local/opt/mysql@5.7/include], @String[PAGER=less], @String[LSCOLORS=Gxfxcxdxbxegedabagacad], @String[GOPATH=/Users/wangji/go], @String[OLDPWD=/], @String[USER=wangji], @String[GOROOT=/usr/local/go], @String[ZSH=/Users/wangji/.oh-my-zsh], @String[TMPDIR=/var/folders/mf/7_3y5nms03g796jygh3ky7_c0000gn/T/], @String[DATASPELL_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/dataspell.vmoptions], @String[SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.sVD3uCR5Vr/Listeners], @String[JAVA_MAIN_CLASS_56714=com.wangji92.arthas.plugin.demo.ArthasPluginDemoApplication], @String[XPC_FLAGS=0x0], @String[WEBIDE_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/webide.vmoptions], @String[M2_HOME=/Users/wangji/Documents/dev/maven/apache-maven-3.6.1], @String[CF_USER_TEXT_ENCODING=0x1F5:0x19:0x34], @String[LESS=-R], @String[PHPSTORM_VM_OPTIONS=/Users/wangji/Documents/dev/idea_agent/jetbra/vmoptions/phpstorm.vmoptions], @String[LC_CTYPE=zh_CN.UTF-8], @String[IDEA_INITIAL_DIRECTORY=/], @String[HOME=/Users/wangji], @String[ ], @String[------------------------- name:random], @String[ ], @String[------------------------- name:applicationConfig: [classpath:/application.properties]], @String[server.port=9092], @String[spring.datasource.url=jdbc:h2:mem:testdb], @String[spring.datasource.driver-class-name=org.h2.Driver], @String[spring.datasource.username=sa], @String[spring.datasource.password=], @String[spring.h2.console.settings.web-allow-others=true], @String[spring.h2.console.path=/h2-console], @String[spring.h2.console.enabled=true], @String[spring.datasource.schema=classpath:schema.sql], @String[spring.datasource.data=classpath:data.sql], @String[logging.level.root=info], @String[logging.level.com.wangji92.arthas.plugin.demo.mapper.CityMapper=info], @String[ognl=-x 3 '#springContext=@com.wangji92.arthas.plugin.demo.common.ApplicationContextProvider@context,#standardServletEnvironment=#springContext.getEnvironment(),+#allProperties={},#propertySourceIterator=#standardServletEnvironment.getPropertySources().iterator(),#propertySourceIterator.{#key=#this.getName(),#allProperties.add(" "),#allProperties.add("------------------------- name:"+#key),#this.getSource() instanceof java.util.Map ?#this.getSource().entrySet().iterator.{#key=#this.key,#allProperties.add(#key+"="+#standardServletEnvironment.getProperty(#key))}:#{}},#allProperties'], @String[vmtool=-x 3 --action getInstances --className org.springframework.context.ApplicationContext --express '#standardServletEnvironment=instances[0].getEnvironment(),#allProperties={},#propertySourceIterator=#standardServletEnvironment.getPropertySources().iterator(),#propertySourceIterator.{#key=#this.getName(),#allProperties.add(" "),#allProperties.add("------------------------- name:"+#key),#this.getSource() instanceof java.util.Map ?#this.getSource().entrySet().iterator.{#key=#this.key,#allProperties.add(#key+"="+#standardServletEnvironment.getProperty(#key))}:#{}},#allProperties' ], @String[ ], @String[------------------------- name:customLast], @String[custom.name=Custom Environment first Name], @String[ ], @String[------------------------- name:devtools], @String[spring.resources.cache.period=0], @String[spring.groovy.template.cache=false], @String[server.servlet.jsp.init-parameters.development=true], @String[spring.mvc.log-resolved-exception=true], @String[spring.thymeleaf.cache=false], @String[spring.freemarker.cache=false], @String[server.error.include-stacktrace=ALWAYS], @String[spring.reactor.debug=true], @String[spring.mustache.cache=false], @String[spring.h2.console.enabled=true], @String[server.servlet.session.persistent=true], @String[spring.template.provider.cache=false], @String[spring.resources.chain.cache=false], ] [arthas@56714]$ version 3.6.7

WangJi92 commented 2 hours ago

arthas 4.x 升级了 ognl 表达式 我尝试了多次 ,只修改了这一个脚本,多次断点跟踪,没找到原因,先解决问题

{#key=#this.key,#value=#this.getValue(),#allProperties.add(#key+\"=\"+#value)}:#{}}

arthas ognl 测试用例

 @Test
    public void testInvalidOgnlExpr2() {
        try {

            StandardEnvironment standardEnvironment  = new StandardEnvironment();
            Map<String,Object> maps = new HashMap<>();
            maps.put("env",standardEnvironment);
            Iterator<Map.Entry<String, Object>> iterator = maps.entrySet().iterator();
            Map.Entry<String, Object> next = iterator.next();
            String key = next.getKey();
            Object value = next.getValue();

            Express unpooledExpress = ExpressFactory.unpooledExpress(OgnlExpressTest.class.getClassLoader());
            unpooledExpress.bind(maps);
            Object wangji = unpooledExpress.get("#standardServletEnvironment=env,+#allProperties={},#propertySourceIterator=#standardServletEnvironment.getPropertySources().iterator(),#propertySourceIterator.{#key=#this.getName(),#allProperties.add(\"                \"),#allProperties.add(\"------------------------- name:\"+#key),#this.getSource() instanceof java.util.Map ?#this.getSource().entrySet().iterator.{#key=#this.key,#value=#this.getValue(),#allProperties.add(#key+\"=\"+#value)}:#{}},#allProperties");

        } catch (Exception e){
            Assert.assertTrue(e.getCause() instanceof ognl.ExpressionSyntaxException);
        }
    }