[alibaba/arthas]springboot starter依赖启动arthas在一台机器无法使用多个应用

2025-11-10 359 views
9
[ ] 我已经在 issues 里搜索,没有重复的issue。 环境信息 Arthas 版本: 3.5.0 重现问题的步骤 依赖springboot starter启动应用 第一个应用能正常启动并且注册到tennel-server控制台 后面启动的应用直接报错

请问这种情况如何解决?

实际运行的结果

Caused by: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException at com.taobao.arthas.agent.attach.ArthasAgent.init(ArthasAgent.java:128) ~[arthas-agent-attach-3.4.3.jar:3.4.3] at com.alibaba.arthas.spring.ArthasConfiguration.arthasAgent(ArthasConfiguration.java:49) ~[arthas-spring-boot-starter-3.4.3.jar:3.4.3] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE] ... 20 common frames omitted Caused by: java.lang.reflect.InvocationTargetException: null at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na] at com.taobao.arthas.agent.attach.ArthasAgent.init(ArthasAgent.java:118) ~[arthas-agent-attach-3.4.3.jar:3.4.3] ... 26 common frames omitted Caused by: java.lang.IllegalStateException: Arthas failed to bind telnet or http port. at com.taobao.arthas.core.server.ArthasBootstrap.bind(ArthasBootstrap.java:356) ~[na:na] at com.taobao.arthas.core.server.ArthasBootstrap.(ArthasBootstrap.java:126) ~[na:na] at com.taobao.arthas.core.server.ArthasBootstrap.getInstance(ArthasBootstrap.java:483) ~[na:na]

回答

8

可以在 application.properties里配置

arthas.telnetPort=0
arthas.httpPort=0

然后arthas会随机listen可用的端口。

如果是完全用 tunnel server来连接的话,也可以配置为 -1 ,这样就不listen了。

4

感谢解答!