{"record":{"id":"b6b78cb01cbb9bca","repo":"apache/cassandra","slug":"trigger-class-s-couldn-t-be-found","errorCode":null,"errorMessage":"Trigger class %s couldn't be found.","messagePattern":"Trigger class (.+?) couldn't be found\\.","errorType":"exception","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/triggers/TriggerExecutor.java","lineNumber":277,"sourceCode":"                triggerClass = td.classOption;\n                if (trigger == null)\n                {\n                    trigger = loadTriggerInstance(td.classOption);\n                    cachedTriggers.put(td.classOption, trigger);\n                }\n                Collection<Mutation> temp = trigger.augment(update);\n                if (temp != null)\n                    tmutations.addAll(temp);\n            }\n            return tmutations;\n        }\n        catch (CassandraException ex)\n        {\n            throw ex;\n        }\n        catch (ClassNotFoundException ex)\n        {\n            throw new ConfigurationException(\"Trigger class \" + triggerClass + \" couldn't be found.\");\n        }\n        catch (Exception ex)\n        {\n            throw new RuntimeException(String.format(\"Exception while executing trigger on table with ID: %s\", update.metadata().id), ex);\n        }\n        finally\n        {\n            Thread.currentThread().setContextClassLoader(parent);\n        }\n    }\n\n    public synchronized Class<? extends ITrigger> loadTriggerClass(String triggerClass) throws Exception\n    {\n        // Allow loading the class regardless of Config, since this could happen as part of TCM replay via\n        // CreateTriggerStatement#apply.\n        // Check that triggerClass is available on the classpath, but do not initialize the class since that would\n        // execute static blocks.\n        Class<? extends ITrigger> trigger = loadTriggerClassWithoutInitialization(triggerClass);","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/triggers/TriggerExecutor.java#L259-L295","documentation":"TriggerExecutor.executeInternal loads a trigger's class by name while swapping the context classloader. If the configured trigger class name cannot be found on the classpath, ClassNotFoundException is caught and rethrown as a ConfigurationException with this message.","triggerScenarios":"Executing a mutation through a table that has a trigger whose triggerClass string is misspelled, refers to a trigger JAR that was dropped/removed from lib/triggers, or was never deployed to all nodes in the cluster.","commonSituations":"Deploying a schema with CREATE TRIGGER on only some nodes; removing a custom trigger jar during rolling upgrades; typos in the fully-qualified class name in the trigger metadata.","solutions":["Verify the trigger class name in the table metadata (DESCRIBE TABLE / system_schema.triggers) matches the deployed class exactly","Copy the trigger JAR to lib/triggers on every node and restart (or nodetool reloadtriggers if applicable)","Check logs for the fully-qualified name and correct package spelling","Remove the trigger definition if the class is intentionally gone"],"exampleFix":"// before\nCREATE TRIGGER trig1 ON ks.t USING 'com.example.MyTrigger';\n// after\nCREATE TRIGGER trig1 ON ks.t USING 'com.example.triggers.MyTriggerClass'; // class must exist in a jar on every node","handlingStrategy":"validation","validationCode":"// verify class availability before issuing mutations that fire triggers\ntry {\n    Class.forName(\"com.example.triggers.MyTriggerClass\");\n} catch (ClassNotFoundException e) {\n    throw new IllegalStateException(\"Trigger class missing on this node: deploy jar to lib/triggers\", e);\n}","typeGuard":null,"tryCatchPattern":"// catch ConfigurationException around mutations on trigger-bearing tables\ntry {\n    session.execute(insert);\n} catch (org.apache.cassandra.exceptions.ConfigurationException e) {\n    if (e.getMessage().contains(\"Trigger class\")) {\n        // deploy/fix trigger jar or drop trigger\n    } else throw e;\n}","preventionTips":["Ship trigger JARs to lib/triggers on every node via configuration management","Use fully-qualified class names and verify with a startup smoke test","Drop triggers from schema before removing their jars","Add trigger class checks to node deployment verification"],"tags":["triggers","classpath","configuration"],"backgroundTag":"class-not-found","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}