metricsCallback: Callback class could not be loaded

Hi all,

We are using datomic pro 0.9.5350 (peer) in a Scala application, and I’m having trouble getting the metricsCallback to work with a Java-style callback.

I have this in my JVM startup options:


I’ve tried creating various different versions of Scala and Java classes to handle the callback, but I can’t seem to get datomic to load the class for the callback. Here is the simplest example I’ve tried:

package util.datomic;

public class DatomicCallback {
    public static void metricsCallback(Object obj) {

At startup, I get this log message:

2019-03-26 16:07:16,340 [WARN] from datomic.callback - {:message "Callback class util.datomic.DatomicCallback could not be loaded", :pid 13256, :tid 101}

I verified there is a compiled util/datomic/DatomicCallback.class in the build artifacts directory tree.

Is there something obviously wrong with what I’m doing, or a way to troubleshoot this further?

Hi Andy,

Have you ensured that the util/datomic/DatomicCallback.class is in the classpath of your JVM process?

Hi Marshall,
Thanks for your reply.

I believe the class is in the classpath, and to double check, I added some test code to the app to try to load the class at startup. I also added a check for a non-existing class to make sure I wasn’t getting a false positive. (This is a scala project).

try {
    println("Loading valid class...")
    val x = Class.forName("util.datomic.DatomicCallback").asInstanceOf[Class[util.datomic.DatomicCallback]]
    println("Loaded class:")

    println("Loading invalid class...")
    val y = Class.forName("util.datomic.DatomicCallbackx").asInstanceOf[Class[util.datomic.DatomicCallback]]
    println("Loaded class:")
  } catch {
    case e: Throwable =>
      println("Failed to load class:")

This prints:

Loading valid class...
Loaded class:
class util.datomic.DatomicCallback
Loading invalid class...
Failed to load class:
java.lang.ClassNotFoundException: util.datomic.DatomicCallbackx

I still get this error from datomic from its attempt to load the callback class:

2019-04-17 22:23:14,326 [WARN] from datomic.callback - {:message "Callback class util.datomic.DatomicCallback could not be loaded", :pid 27537, :tid 1016}