Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arthas的一些特殊用法文档说明 #71

Closed
hengyunabc opened this issue Sep 19, 2018 · 64 comments
Closed

Arthas的一些特殊用法文档说明 #71

hengyunabc opened this issue Sep 19, 2018 · 64 comments

Comments

@hengyunabc
Copy link
Collaborator

hengyunabc commented Sep 19, 2018

收集Arthas里的一些特殊用法。

ognl表达式官网:https://commons.apache.org/proper/commons-ognl/language-guide.html

@hengyunabc hengyunabc changed the title Arthas的一些特殊用法需要文档说明 Arthas的一些特殊用法文档说明 Sep 19, 2018
@hengyunabc
Copy link
Collaborator Author

hengyunabc commented Sep 19, 2018

查看第一个参数:

$ watch com.taobao.container.Test test "params[0]"
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 34 ms.
@ArrayList[
    @Pojo[com.taobao.container.Test$Pojo@75a1cd57],

    @Pojo[com.taobao.container.Test$Pojo@3d012ddd],

    @Pojo[com.taobao.container.Test$Pojo@6f2b958e],

    @Pojo[com.taobao.container.Test$Pojo@1eb44e46],

    @Pojo[com.taobao.container.Test$Pojo@6504e3b2],

查看第一个参数的size:

$ watch com.taobao.container.Test test "params[0].size()"
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 22 ms.
@Integer[40]

将结果按name属性投影:

$ watch com.taobao.container.Test test "params[0].{ #this.name }"
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 25 ms.
@ArrayList[
    @String[name 0],

    @String[name 1],

按条件过滤:

$ watch com.taobao.container.Test test "params[0].{? #this.name == null }" -x 2
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 27 ms.
@ArrayList[
    @Pojo[
        name=null,
        age=@Integer[32],
        hobby=null,
    ],
]
@ArrayList[
    @Pojo[
        name=null,
        age=@Integer[31],
        hobby=null,
    ],
]

$ watch com.taobao.container.Test test "params[0].{? #this.name != null }" -x 2
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 24 ms.
@ArrayList[
    @Pojo[
        name=@String[name 1],
        age=@Integer[3],
        hobby=null,
    ],

过滤后统计:

$ watch com.taobao.container.Test test "params[0].{? #this.age > 10 }.size()" -x 2
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 29 ms.
@Integer[31]
@Integer[31]

判断字符串相等

比如第一个参数是String类型:

$ watch com.demo.Test test 'params[0]=="xyz"'

判断long型

$ watch com.demo.Test test 'params[0]==123456789L'

@hengyunabc
Copy link
Collaborator Author

hengyunabc commented Sep 19, 2018

子表达式求值:

$ watch com.taobao.container.Test test "params[0].{? #this.age > 10 }.size().(#this > 20 ? #this - 10 : #this + 10)" -x 2
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 76 ms.
@Integer[21]
@Integer[21]

选择第一个满足条件:

$ watch com.taobao.container.Test test "params[0].{^ #this.name != null}" -x 2
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 58 ms.
@ArrayList[
    @Pojo[
        name=@String[name 0],
        age=@Integer[2],
        hobby=null,
    ],
]

$ watch com.taobao.container.Test test "params[0].{^ #this.name != null}.size()" -x 2
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 57 ms.
@Integer[1]

选择最后一个满足条件:

$ watch com.taobao.container.Test test "params[0].{$ #this.name != null}" -x 2
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 62 ms.
@ArrayList[
    @Pojo[
        name=@String[name 39],
        age=@Integer[41],
        hobby=null,
    ],
]

@hengyunabc
Copy link
Collaborator Author

hengyunabc commented Sep 19, 2018

访问静态变量

  • 在watch命令中访问如下,但是会受到classloader的限制,不推荐使用
$ watch com.taobao.container.Test test "@com.taobao.container.Test@m"
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 36 ms.
@HashMap[
    @String[a]:@String[aaa],

    @String[b]:@String[bbb],
]
  • 使用新版本中的getstatic命令,通过-c指定classloader,可以查看任意static变量,同时支持ognl表达式处理
$ getstatic com.alibaba.arthas.Test n 'entrySet().iterator.{? #this.key.name()=="STOP"}'
field: n
@ArrayList[
    @Node[STOP=bbb],
]
Affect(row-cnt:1) cost in 68 ms.

$ getstatic com.alibaba.arthas.Test m 'entrySet().iterator.{? #this.key=="a"}'
field: m
@ArrayList[
    @Node[a=aaa],
]

@hengyunabc
Copy link
Collaborator Author

hengyunabc commented Sep 19, 2018

调用静态方法

$ watch com.taobao.container.Test test "@java.lang.Thread@currentThread()"

调用静态方法再调用非静态方法

$ watch com.taobao.container.Test test "@java.lang.Thread@currentThread().getContextClassLoader()"

@hengyunabc
Copy link
Collaborator Author

hengyunabc commented Sep 19, 2018

匹配线程&正则多个类多个方法

trace -E 'io\.netty\.channel\.nio\.NioEventLoop|io\.netty\.util\.concurrent\.SingleThreadEventExecutor'  'select|processSelectedKeys|runAllTasks' '@Thread@currentThread().getName().contains("IO-HTTP-WORKER-IOPool")&&#cost>500'

@jieyuan-shen
Copy link

jieyuan-shen commented May 25, 2019

按条件过滤:

$ watch com.taobao.container.Test test "{params}" "params[0].{? #this.name == null }.size()>0" -x 2
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 27 ms.
@ArrayList[
    @Pojo[
        name=null,
        age=@Integer[32],
        hobby=null,
    ],
]
@ArrayList[
    @Pojo[
        name=null,
        age=@Integer[31],
        hobby=null,
    ],
]

实际用下来,需要添加 .size()>0,并且条件表达式和返回表达式是两个表达式。
其中条件表达式, 如果是要对字符串做比较可以写成这样:
'params[0].{? #this.deviceKey =="KPmIDmPKMV"}.size()>0'
即,外面用单引号,里面是双引号。

@jaime0815
Copy link

jaime0815 commented Jul 29, 2019

内部类怎么使用

@hengyunabc
Copy link
Collaborator Author

hengyunabc commented Jul 30, 2019

内部类怎么使用

OuterClass$innerClassName

@leiguorui
Copy link

leiguorui commented Aug 16, 2019

ognl怎么调用spring bean中的非静态方法??

@hengyunabc
Copy link
Collaborator Author

hengyunabc commented Aug 16, 2019

ognl怎么调用spring bean中的非静态方法??

@leiguorui #482

@leonHan01
Copy link

leonHan01 commented Aug 28, 2019

按条件过滤:

$ watch com.taobao.container.Test test "{params}" "params[0].{? #this.name == null }.size()>0" -x 2
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 27 ms.
@ArrayList[
    @Pojo[
        name=null,
        age=@Integer[32],
        hobby=null,
    ],
]
@ArrayList[
    @Pojo[
        name=null,
        age=@Integer[31],
        hobby=null,
    ],
]

实际用下来,需要添加 .size()>0,并且条件表达式和返回表达式是两个表达式。
其中条件表达式, 如果是要对字符串做比较可以写成这样:
'params[0].{? #this.deviceKey =="KPmIDmPKMV"}.size()>0'
即,外面用单引号,里面是双引号。

一定要加 size()>0 才行,老哥thanks

@iamorchid
Copy link

iamorchid commented Sep 10, 2019

[arthas@20]$ ognl '@com.envisioniot.enos.iot_log_sdk.core.ESClient@defaultESClient'
Failed to get static, exception message: ognl.OgnlException: Could not get static field defaultESClient from class com.envisioniot.enos.iot_log_sdk.core.ESClient [java.lang.ClassNotFoundException: Unable to resolve class: com.envisioniot.enos.iot_log_sdk.core.ESClient], please check $HOME/logs/arthas/arthas.log for more details.
[arthas@20]$
[arthas@20]$ getstatic com.envisioniot.enos.iot_log_sdk.core.ESClient defaultESClient
field: defaultESClient
@ESClient[
    logger=@Logger[com.envisioniot.enos.iot_log_sdk.core.ESClient:INFO in config_web],
    client=@PreBuiltTransportClient[org.elasticsearch.transport.client.PreBuiltTransportClient@61f30b80],
    indicesAdminClient=@IndicesAdmin[org.elasticsearch.client.support.AbstractClient$IndicesAdmin@73b9bf19],
    connected=@Boolean[true],
    bulkProcessor=@BulkProcessor[org.elasticsearch.action.bulk.BulkProcessor@4ee692a3],
    DEFAULT_TYPE=@String[default_type],
    mqttLogClient=null,
    eventManageLogClient=null,
    serviceInvokeLogClient=null,
    attrHistoryLogClient=null,
    defaultESClient=@ESClient[com.envisioniot.enos.iot_log_sdk.core.ESClient@379aef66],
]
Affect(row-cnt:1) cost in 11 ms.

为啥ognl不起作用而getstatic却在这里起作用? 我是在tomcat容器测试得。

@hengyunabc
Copy link
Collaborator Author

hengyunabc commented Sep 11, 2019

[arthas@20]$ ognl '@com.envisioniot.enos.iot_log_sdk.core.ESClient@defaultESClient'
Failed to get static, exception message: ognl.OgnlException: Could not get static field defaultESClient from class com.envisioniot.enos.iot_log_sdk.core.ESClient [java.lang.ClassNotFoundException: Unable to resolve class: com.envisioniot.enos.iot_log_sdk.core.ESClient], please check $HOME/logs/arthas/arthas.log for more details.
[arthas@20]$
[arthas@20]$ getstatic com.envisioniot.enos.iot_log_sdk.core.ESClient defaultESClient
field: defaultESClient
@ESClient[
    logger=@Logger[com.envisioniot.enos.iot_log_sdk.core.ESClient:INFO in config_web],
    client=@PreBuiltTransportClient[org.elasticsearch.transport.client.PreBuiltTransportClient@61f30b80],
    indicesAdminClient=@IndicesAdmin[org.elasticsearch.client.support.AbstractClient$IndicesAdmin@73b9bf19],
    connected=@Boolean[true],
    bulkProcessor=@BulkProcessor[org.elasticsearch.action.bulk.BulkProcessor@4ee692a3],
    DEFAULT_TYPE=@String[default_type],
    mqttLogClient=null,
    eventManageLogClient=null,
    serviceInvokeLogClient=null,
    attrHistoryLogClient=null,
    defaultESClient=@ESClient[com.envisioniot.enos.iot_log_sdk.core.ESClient@379aef66],
]
Affect(row-cnt:1) cost in 11 ms.

为啥ognl不起作用而getstatic却在这里起作用? 我是在tomcat容器测试得。

ognl命令默认只会去 SystemClassLoader 里找类。 getstatic 命令会直接找所有JVM里加载的类,而tomcat的classloader是自己的,所以只有 getstatic 命令能找到。 ognl 命令要显式指定classloader 。

@kingandsorrow
Copy link

kingandsorrow commented Sep 23, 2019

请问,watch命令查看returnObj中的属性值怎么写?
比如:@OrgPermVO为返回值对象,想查看对象中orgIds的值

ts=2019-09-23 22:08:27; [cost=84.447395ms] result=@ArrayList[
    @Object[][
        @OrgEntryParam[com.xxxxxxx.param.OrgEntryParam@675acde4],
    ],
    @OrgPermVO[
        serialVersionUID=@Long[-282076766124881226],
        orgIds=@HashSet[isEmpty=false;size=24],
        deptIds=@HashSet[isEmpty=false;size=1],
        withAllOrgs=@Boolean[true],
        withAllDepts=@Boolean[false],
        usingDeptDataperm=@Boolean[true],
    ],
]

@YuanSim
Copy link

YuanSim commented Sep 26, 2019

重载的方法怎么查看指定的方法呢

@jiangshubian
Copy link

jiangshubian commented Oct 6, 2019

请问,watch命令查看returnObj中的属性值怎么写?
比如:@OrgPermVO为返回值对象,想查看对象中orgIds的值

ts=2019-09-23 22:08:27; [cost=84.447395ms] result=@ArrayList[
    @Object[][
        @OrgEntryParam[com.xxxxxxx.param.OrgEntryParam@675acde4],
    ],
    @OrgPermVO[
        serialVersionUID=@Long[-282076766124881226],
        orgIds=@HashSet[isEmpty=false;size=24],
        deptIds=@HashSet[isEmpty=false;size=1],
        withAllOrgs=@Boolean[true],
        withAllDepts=@Boolean[false],
        usingDeptDataperm=@Boolean[true],
    ],
]

加上-x 3

@wayneliu91
Copy link

wayneliu91 commented Oct 29, 2019

请教一个问题:如下命令,测试的时候把watch换成stack就没反应了。
watch class method "params[0].{? #this.id == 0 }" -n 2

@johnjey
Copy link

johnjey commented Nov 5, 2019

能watch方法内的局部变量的值吗?

@hengyunabc
Copy link
Collaborator Author

hengyunabc commented Nov 5, 2019

能watch方法内的局部变量的值吗?

不能,用 redefine

@nimil
Copy link

nimil commented Nov 30, 2019

重载方法有办法trace 么

@XiaoyiPeng
Copy link

XiaoyiPeng commented Dec 17, 2019

请问watch命令:条件表达式中有特殊字符,如何转义,用ongl的转义好像不行。
如:watch org.apache.rocketmq.broker.topic.TopicConfigManager createTopicInSendMessageBackMethod "{params,returnObj}" 'params[0]=="%RETRY%group_cccc"' -n 1 中的 '%'字符 该如何转义?

@hengyunabc
Copy link
Collaborator Author

hengyunabc commented Dec 18, 2019

请问watch命令:条件表达式中有特殊字符,如何转义,用ongl的转义好像不行。
如:watch org.apache.rocketmq.broker.topic.TopicConfigManager createTopicInSendMessageBackMethod "{params,returnObj}" 'params[0]=="%RETRY%group_cccc"' -n 1 中的 '%'字符 该如何转义?

可以直接用ognl命令输出字符串结果:

$ ognl '"%RETRY%group_cccc"'
@String[%RETRY%group_cccc]

@gaonico
Copy link

gaonico commented Dec 19, 2019

入參是List的类型,
watch me.server.api.ChainStoreDeliveryAreaMgmtServiceImpl queryChainStoreDeliveryArea "params[0].{#this.chainStoreIds}",
返回了
ts=2019-12-19 20:28:52; [cost=16.401208ms] result=@Arraylist[
@Arraylist[isEmpty=false;size=1],
想再过滤条件,chainStoreIds==[11253129],才需要返回,这个要怎么写呀?

@just-JL
Copy link

just-JL commented Dec 27, 2019

怎么访问类变量的值呢?非静态变量

@WangJi92
Copy link
Contributor

WangJi92 commented Aug 13, 2020

#1424 arthas 获取spring被代理的目标对象

@kgdngitfk
Copy link

kgdngitfk commented Sep 22, 2020

请求一下watch命令支不支持“com.xx.**.controller * ”这种包路径通配的方式?

@zhengkaifor
Copy link

zhengkaifor commented Nov 11, 2020

想问下returnObj 怎么映射

@WangJi92
Copy link
Contributor

WangJi92 commented Jan 8, 2021

某个同事问 如何watch 构造函数,想观察构造 函数

如何 watch 构造函数

watch com.wangji92.arthas.plugin.demo.controller.User <init>

如何怎么知道构造函数是啥

[arthas@33447]$ sm com.wangji92.arthas.plugin.demo.controller.User
com.wangji92.arthas.plugin.demo.controller.User <init>(Ljava/lang/String;Ljava/lang/Long;)V
com.wangji92.arthas.plugin.demo.controller.User <init>()V
com.wangji92.arthas.plugin.demo.controller.User toString()Ljava/lang/String;
com.wangji92.arthas.plugin.demo.controller.User getName()Ljava/lang/String;
com.wangji92.arthas.plugin.demo.controller.User setName(Ljava/lang/String;)V
com.wangji92.arthas.plugin.demo.controller.User setAge(Ljava/lang/Long;)V
com.wangji92.arthas.plugin.demo.controller.User getAge()Ljava/lang/Long;

@lixuanbin
Copy link

lixuanbin commented Feb 20, 2021

great examples! mark~

@Truelig
Copy link

Truelig commented Mar 16, 2021

wathc怎么过滤掉代理类的信息,支持正则表达式吗

@hengyunabc
Copy link
Collaborator Author

hengyunabc commented Mar 16, 2021

wathc怎么过滤掉代理类的信息,支持正则表达式吗

watch -h ,watch命令支持正则,但用 exclude 参数更方便 。

@Truelig
Copy link

Truelig commented Mar 18, 2021

怎么调用普通类(非spring管理的)方法

@Truelig
Copy link

Truelig commented Mar 25, 2021

某个类有个静态变量 private static String s ="abc";
怎么把这个 s 动态的改成"hello world"

@pixystone
Copy link

pixystone commented May 25, 2021

如何访问内部私有类: private class Foo {}

@cqxxxxxxxx
Copy link

cqxxxxxxxx commented Jun 17, 2021

某个类有个静态变量 private static String s ="abc";
怎么把这个 s 动态的改成"hello world"

getstatic com.xyz.HelloWorld s "#s='abc'"

@WangJi92
Copy link
Contributor

WangJi92 commented Jul 31, 2021

反射修改实例的变量

com.xxx.cache.CacheAspect 中的 boolean 变量 cacheEnabled 修改为false

vmtool

vmtool -x 3 --action getInstances --className com.xxx.cache.CacheAspect --express '#field=instances[0].getClass().getDeclaredField("cacheEnabled"),#field.setAccessible(true),#field.set(instances[0],false)' -c 3bd94634

ognl get spring static context 修改

ognl -x 3 '#springContext=@com.xxx.util.SpringUtil@context,#instance=#springContext.getBean("lavaCacheAspect"),#field=@com.xxx.cache.CacheAspect@class.getDeclaredField("cacheEnabled"),#field.setAccessible(true),#field.set(#instance,false)' -c 3bd94634

如果是final 的变量也可以

CommonController 中定义了一个 string 的final FINAL_VALUE 修改值

vmtool -x 4 --action getInstances --className com.wangji92.arthas.plugin.demo.controller.CommonController  --express '#field=instances[0].getClass().getDeclaredField("FINAL_VALUE"),#modifiers=#field.getClass().getDeclaredField("modifiers"),#modifiers.setAccessible(true),#modifiers.setInt(#field,#field.getModifiers() & ~@java.lang.reflect.Modifier@FINAL),#field.setAccessible(true),#field.set(instances[0]," 3333")' -c  18b4aac2

@mhf123
Copy link

mhf123 commented Aug 10, 2021

怎么过滤参数类型为Class的方法

@mhf123
Copy link

mhf123 commented Aug 10, 2021

怎么过滤参数类型为Class的方法

没有试过 你可以看看这个行不行

watch com.XXX xxx '{params,returnObj,throwExp}'  -n 5  -x 3  'params[0]== @xxxx@class'  

似乎不行

@WangJi92
Copy link
Contributor

WangJi92 commented Aug 10, 2021

怎么过滤参数类型为Class的方法

image

观察

watch com.wangji92.arthas.plugin.demo.controller.StaticTest invokeClass '{returnObj,throwExp}'  -n 5  -x 3  'params[0].getName().equals(@com.wangji92.arthas.plug.demo.controller.User@class.getName())' -v

调用

ognl -x 3 '@com.wangji92.arthas.plugin.demo.controller.StaticTest@invokeClass(@com.wangji92.arthas.plugin.demo.controller.User@class)' -c 30883c26

测试结果

一次调用传递object 一次调用传递 user这个class 测试ok

image

@L0601
Copy link

L0601 commented Aug 13, 2021

watch 能查看整个调用栈各个方法的输入输出么?

@soye-yang
Copy link

soye-yang commented Nov 25, 2021

背景是通过ognl获取到容器内的类调用实例方法,因为参数比较复杂需要通过json进行转换,但是fastjson转换时需要指定class,通过 ognl '@Class@forName("com.XXX.XXXX.common.model.psc.createscporderbylp.req.CreateScpOrderByLpReqDTO")' -c 6ad82709尝试获取类时报错java.lang.ClassNotFoundException,日志看加载类的classloader使用的是默认的,不知道能不能改进使用当前指定的classloader进行加载

这个现在好像还是有问题

@WangJi92
Copy link
Contributor

WangJi92 commented Feb 24, 2022

复杂参数调用 使用Json 转换为具体的类信息

毕竟Ognl 构造起来挺麻烦的对于复杂的参数
语法糖 直接使用这种不太ok @java.lang.Class@forName(" ") ,获取clsss 信息 直接使用语法糖 @xxxlass@class

问题来源

我想调用spring 某个service bean 的方法,方法入参包含了复杂对象,我拿到了对象的json str 所以我用JSON.parseObject(str,Class.forName("xxxClass")) 来构建参数

image

例子

image

vmtool -x 3 --action getInstances --className com.wangji92.arthas.plugin.demo.controller.CommonController  --express 'instances[0].userFastJson(@com.alibaba.fastjson.JSON@parseObject("{\"name\":\"name\",\"age\":18}",@com.wangji92.arthas.plugin.demo.controller.User@class))'  -c 888b915

image

这里面不允许输入中文哦,如果需要输入中文可以对Str 先进行base64处理 参考base64 处理中文

@a139169370
Copy link

a139169370 commented Mar 22, 2022

入參是 List 的类型, watch me.server.api.ChainStoreDeliveryAreaMgmtServiceImpl queryChainStoreDeliveryArea "params[0].{#this.chainStoreIds}", 返回了 ts=2019-12-19 20:28:52; [cost=16.401208ms] result=@Arraylist[ @Arraylist[isEmpty=false;size=1], 想再过滤条件,chainStoreIds==[11253129],才需要返回,这个要怎么写呀?

我的解决方案是调用公共类去筛选出来,arthas支持调用static方法的,你可以写一个方法例如
public static boolean getTargets(ArrayList list) {
for(Demo demo : list) {
if (demo.chainStoreIds == 11253129){
return true;
}
}
return false;
}

然后
watch me.server.api.ChainStoreDeliveryAreaMgmtServiceImpl queryChainStoreDeliveryArea "params[0].{#this.chainStoreIds}" '@全限定类目@getTargets(returnObj) == true'

伪代码写的有点粗糙,但是差不多这个意思

@a139169370
Copy link

a139169370 commented Mar 22, 2022

重载的方法怎么查看指定的方法呢

watch xxx xxx '{params,returnObj,throwExp}' 'params.length == 4 && params[1] instanceof java.lang.Throwable && params[0] == -8' -n 5 -x 3

可以在条件里面这样写,根据参数个数、参数类型和已知入参数据指定

@a139169370
Copy link

a139169370 commented Mar 22, 2022

怎么过滤参数类型为 Class 的方法

watch com.XXX xxx '{params,returnObj,throwExp}' -n 5 -x 3 'params[0] instanceof xxx'

可以这样判断参数类型

@a139169370
Copy link

a139169370 commented Mar 22, 2022

入参是 Set [Long] 类型,watch 怎么加条件 size=1,且 params [0] 的第一个元素是 436546745 值?

试试这个吧
watch com.XXX xxx '{params,returnObj,throwExp}' 'params.size() == 1 && (Long)testCacheKeys.toArray()[0] == 436546745' -n 5 -x 3

但是不太建议这样做,毕竟强转了,可以考虑写一个static方法,然后调用其来筛选

@alibaba alibaba deleted a comment from soye-yang Mar 22, 2022
@AndersIves
Copy link

AndersIves commented Jun 25, 2022

可以new对象并赋值吗

@Flyhww0602
Copy link

Flyhww0602 commented Oct 31, 2022

ongl 表达式怎么传Long 类型参数呢? ognl -c 3af49f1c '@util.ApplicationContextUtil@getBeanByType(@CacheService@class).getQCache((Long)1243860912981827585)'
这样好像是不行的呢

@soye-yang
Copy link

soye-yang commented Oct 31, 2022

ongl 表达式怎么传Long 类型参数呢? ognl -c 3af49f1c '@util.ApplicationContextUtil@getBeanByType(@CacheService@class).getQCache((Long)1243860912981827585)' 这样好像是不行的呢

就1243860912981827585l 后面带个字母l就行了

@Flyhww0602
Copy link

Flyhww0602 commented Oct 31, 2022

ognl -c 3af49f1c '@util.ApplicationContextUtil@getBeanByType(@CacheService@class).getQCache((Long)1243860912981827585)'这样是怎么传不了的呢?

1243860912981827585个背带就行了

试过了 不行呢

@lipenghao1216
Copy link

lipenghao1216 commented Nov 7, 2022

returnObj是一个map,map的key是class对象时, 怎么查看某个key的value呢,此时我的ognl表达式应该怎么写?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests