aws / aws/aws-xray-java-agent

Java agent interferes with Spring Boot executable jar classpath resolution

Open
#118 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
46
Forks
20
PR merge metrics
No merged PRs in 30d

Description

I have a [trivial sample Spring Boot application](https://github.com/corey-cole/merlin/) that I'm attempting to run as an executable jar. The app runs fine without the agent with Jetty and Tomcat. The app also runs fine with the agent when started via Maven. However, starting the executable jar with the documented instructions for including an agent results in the error `java.lang.NoClassDefFoundError: javax/servlet/Filter`.

This class is definitely available:
```
[ssm-user@ip-10-0-146-244 merlin]$ unzip -l target/merlin-svc.war | grep javax
95806 03-17-2023 19:36 WEB-INF/lib/javax.servlet-api-3.1.0.jar
26586 03-17-2023 19:36 WEB-INF/lib/javax.annotation-api-1.3.2.jar
```

Working invocations:
```bash
./mvnw spring-boot:run -Dspring-boot.run.jvmArguments="-javaagent:/opt/aws/disco/disco-java-agent.jar=pluginPath=/opt/aws/disco/disco-plugins/"

# This only works with the Netty branch
java -jar merlin-svc.war
```

Failing invocation:
```bash
# Same behavior with and without verbose logging, see attached log below
java -javaagent:/opt/aws/disco/disco-java-agent.jar=pluginPath=/opt/aws/disco/disco-plugins/:loggerfactory=software.amazon.disco.agent.reflect.logging.StandardOutputLoggerFactory:verbose -jar /opt/xxxx/merlin/merlin-svc.war
```

[disco.log](https://github.com/aws/aws-xray-java-agent/files/11005277/disco.log)

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.