Java APM Agent throws ClassNotFoundException in Wildfly


(Mdindoffer) #1

We are using the Java APM agent v1.1.0 for monitoring a webapp in Wildfly 9.0.2.FINAL running on OpenJDK 8.
Everything works fine, until the the apm-agent-api is thrown into the mix. Whenever we access the ElasticApm class, it throws a ClassNotFoundException.
I've created a tiny HelloWorld example for reproducing the exception on github.

The Agent api is correctly included in the application war. However the api classes are simply not loaded.

Things I've tried:

  • Adding JBOSS_MODULES_SYSTEM_PKGS="co.elastic.apm"
  • Deploying the apm-agent-api as a global-module
  • Deploying the example to newest Wildfly 14.0.2.FINAL

Nothing helps. APM logs here
Stacktrace here

Until this is solved I suggest adding a note to Wildfly in Supported technologies.


(Felix Barnsteiner) #2

Hi,

it looks like the apm-agent-api jar did not make it into your .war/WEB-INF/lib could you verify that?

Cheers,
Felix


(Mdindoffer) #3

Hi,
The apm-agent-api.jar is correctly included in the .war/WEB-INF/lib directory alongside other dependencies.


(Felix Barnsteiner) #4

I was able to reproduce this in this PR: https://github.com/elastic/apm-agent-java/pull/361

I have the suspicion that this is related to the enabled bootdelegation for co.elastic.apm.*. That may make it so that these classes can only be loaded from the bootstrap class loader and not from the application class loader where the API module is at.