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

Java agent interferes with Spring Boot executable jar classpath resolution #118

Open
corey-cole opened this issue Mar 17, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@corey-cole
Copy link

I have a trivial sample Spring Boot application 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:

./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:

# 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

@willarmiros
Copy link
Contributor

Hi @corey-cole - thank you for filing this bug, we will add it to our backlog to improve our Spring Boot support.

In the meantime, we recommend trying out the ADOT Java agent with X-Ray to auto-instrument your Java apps: https://aws-otel.github.io/docs/getting-started/java-sdk/trace-auto-instr

@willarmiros willarmiros added the bug Something isn't working label Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants