Java APM with Tomcat & Quartz

Hello Elastic Team,

I would test APM java with Tomcat application. My code use Quartz Job scheduler with JDBC connection (MariadDB).
I've configured elk java agent, adding export

CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/elastic-apm-agent-.jar"


At startup, I've an error :

2018-07-11 11:55:38,839 [QuartzScheduler_ekContractScheduler-v2-dev1531302937988_MisfireHandler] [ERROR] [o.q.impl.jdbcjobstore.JobStoreTX] - MisfireHandler: Error handling misfires: Failed to obtain DB connection from data source 'ekds': java.lang.NoClassDefFoundError: co/elastic/apm/jdbc/StatementInstrumentation
org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'ekds': java.lang.NoClassDefFoundError: co/elastic/apm/jdbc/StatementInstrumentation
at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(
at org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(
at org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(
at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.manage(
at org.quartz.impl.jdbcjobstore.JobStoreSupport$
Caused by: java.lang.NoClassDefFoundError: co/elastic/apm/jdbc/StatementInstrumentation

I've try to add apm-jdbc-plugin-0.6.0.jar into $CATALINA_BASE/lib, no success.

Why co/elastic/apm/jdbc/StatementInstrumentation isn't in the classpath ?



Hi Christophe,
Thanks for trying out the agent!

A few questions:

  • Is your application using an OSGi container or something similar?
  • How do you deploy the quartz implementation? Is it inside your war file under WEB-INF/lib?
  • Which quarz version are you using?
  • Which connection pool are you using?


Hi Felix,

First of all : Great project :slight_smile:

  • Application does not use OSGI. We use :
    Jersey (with osgi-resource-locator in dependence)
  • Quartz is deployed into the WAR (WEB-INF/lib/)
  • Quartz version is v2.3.0
  • Connection pool is HikariCP v3.1.0



What do you need the osgi-resource-locator for? Are you referring to

Could you send me a small application which reproduces the problem? It would be really awesome if you could do this as I can't reproduce that problem on Tomcat.

This is my dependencies :


=> Jersey version is 2.27

org.glassfish.hk2:osgi-resource-locator:jar:1.0.1 come from :

[INFO] +- org.glassfish.jersey.ext:jersey-bean-validation:jar:2.27:compile
[INFO] |  |  |  +- org.glassfish.hk2.external:javax.inject:jar:2.5.0-b42:compile
[INFO] |  |  |  +- org.glassfish.jersey.core:jersey-common:jar:2.27:compile
[INFO] |  |  |  |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] |  |  |  |  \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile

I'll forward your light application request to my dev team but I don't have many hopes..


Just as a clarification - does the problem occur on Tomcat or on Glassfish? Glassfish is currently not supported and shows the exact same symptoms (NoClassDefFoundError). This is because the OSGi container does not allow access to the agent classes.

What the agent currently does to support other OSGi environments, such as WebSpere, is to set the system property org.osgi.framework.bootdelegation=co.elastic.apm.*. But that somehow does not work on Glassfish and I have yet to find the reason.


Problem occur on Tomcat, Glassfish is only the GroupID for jersey because is a Glassfish project ( :wink:

However, may be this is a requirement (agentClass access) with osgi-resource-locator even with Tomcat ?

Hey, I've recently been adding support for Glassfish. If we are lucky it fixes your problem as well. Could you try with this snapshot version of the agent:

Hi Felix,

Yes it's working with this new version :slight_smile:
Thanks a lot.

I'll continue the agent integration test.


Hey, that's great!

I can't promise any release date however, since it requires a change in a library I'm using (Byte Buddy).

Thanks for the feedback,

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.