elastic / elastic/apm-agent-java

Fix modularized applications having a dependency version conflict

Open
#2,373 2 comments 0 reactions 1 assignee Claimed by @jackshirazi View on GitHub
agent-java bug
Dominant language
Java
Stars
594
Forks
338
Avg merge
1d 13h
Merged PRs (30d)
25

Description

discussion in https://discuss.elastic.co/t/apm-java-agent-v1-27-0-instrumention-errors-on-modulepath/292877

## Describe the bug
When a modularized application (ie uses module-info.java, the Java Platform Module System JPMS) has a dependency that the agent also has, it look like the module specified dependency is first resolved by all classloaders because that's how the module system is implemented. For the agent to have isolated dependencies, it seems we need to use module layers

## Steps to reproduce
Per the example in the discussion thread - a basic hello world spring-boot modularized application

## Expected behavior
In this case spring-boot has a dependency on byte-buddy version 1.11.22, while the agent has a dependency on version 1.12.3, but version 1.11.22 is loaded and used by the agent, resulting in stack trace errors and feature failure. Lines in the stack traces would include many entries like
```
at net.bytebuddy@1.11.22/net.bytebuddy....
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.