alibaba / alibaba/one-java-agent
解决agent的API类在自定义的ClassLoader里加载的问题
- Dominant language
- Java
- Stars
- 579
- Forks
- 128
- PR merge metrics
- No merged PRs in 30d
Description
* 默认情况下,加载java agent的是SystemClassLoader,那么应用自己定义的ClassLoader,如果parent不是 SystemClassLoader,就加载不到java agent里的类。
比如,有一个类Foo,它有一个函数bar:
```java
public class Foo {
public void bar() {
}
}
```
有一个Java Agent想做一些类增强,会插入一些代码:
```java
public class Foo {
public void bar() {
SampleAgent.log("here");
}
}
```
* 这就要求加载Foo的ClassLoader必须要能加载到SystemClassLoader里的`SampleAgent`类。
Contributor guide
No contributing guide indexed for this repository
Research direction
No files or tests are named. Start by tracing how the Java agent exposes SampleAgent to classes loaded by an application-defined ClassLoader whose parent is not the SystemClassLoader, then reproduce the Foo/bar example. Done means the injected SampleAgent.log("here") call can resolve and run in that loader setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100