{"record":{"id":"afc1d6a4c5124002","repo":"pinpoint-apm/pinpoint","slug":"unknown-shutdownhookregister","errorCode":null,"errorMessage":"Unknown ShutdownHookRegister : {}","messagePattern":"Unknown ShutdownHookRegister : (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/ShutdownHookRegisterProvider.java","lineNumber":105,"sourceCode":"            return JDK7_SHUTDOWN_HOOK_REGISTER;\n        }\n        return null;\n    }\n\n    private ShutdownHookRegister createShutdownHookRegister(String classToLoad) {\n        if (classToLoad == null) {\n            return RUNTIME_SHUTDOWN_HOOK_REGISTER;\n        }\n\n        try {\n            @SuppressWarnings(\"unchecked\")\n            Class<ShutdownHookRegister> shutdownHookRegisterClass = (Class<ShutdownHookRegister>) Class.forName(classToLoad);\n\n            try {\n                Constructor<ShutdownHookRegister> shutdownHookRegisterConstructorConstructor = shutdownHookRegisterClass.getConstructor();\n                return shutdownHookRegisterConstructorConstructor.newInstance();\n            } catch (NoSuchMethodException e) {\n                logger.warn(\"Unknown ShutdownHookRegister : {}\", classToLoad);\n                return RUNTIME_SHUTDOWN_HOOK_REGISTER;\n            }\n        } catch (ReflectiveOperationException e) {\n            logger.warn(\"Error creating ShutdownHookRegister [\" + classToLoad + \"]\", e);\n        }\n        return RUNTIME_SHUTDOWN_HOOK_REGISTER;\n    }\n\n    private static class RuntimeShutdownHookRegister implements ShutdownHookRegister {\n\n        private final Logger logger = LogManager.getLogger(this.getClass());\n\n        @Override\n        public void register(Thread thread) {\n            Runtime.getRuntime().addShutdownHook(thread);\n            logger.info(\"register() completed. (ShutdownHook registered in java.lang.Runtime.)\");\n        }\n","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/ShutdownHookRegisterProvider.java#L87-L123","documentation":"WARN in ShutdownHookRegisterProvider.createShutdownHookRegister: the configured shutdown hook class was found via Class.forName but has no no-arg constructor (NoSuchMethodException), so the provider logs this and falls back to RUNTIME_SHUTDOWN_HOOK_REGISTER. The agent keeps running with the default runtime shutdown hook instead of the configured one.","triggerScenarios":"Setting the custom ShutdownHookRegister class name (profiler.shutdown.hook.register class config) to a class that lacks a public no-argument constructor.","commonSituations":"Custom ShutdownHookRegister implemented with only parameterized constructors; class changed API between versions; using a class from a different library that isn't a proper ShutdownHookRegister implementation.","solutions":["Add a public no-argument constructor to the configured ShutdownHookRegister class.","Verify the configured class name points to the intended implementation.","Accept the RUNTIME_SHUTDOWN_HOOK_REGISTER fallback if a custom hook is not required."],"exampleFix":"// before\npublic class MyShutdownHookRegister implements ShutdownHookRegister {\n  public MyShutdownHookRegister(String name) { ... }\n}\n// after\npublic class MyShutdownHookRegister implements ShutdownHookRegister {\n  public MyShutdownHookRegister() { }\n  public MyShutdownHookRegister(String name) { ... }\n}","handlingStrategy":"fallback","validationCode":"Class<?> c = Class.forName(className);\nif (!ShutdownHookRegister.class.isAssignableFrom(c) || c.getConstructor() == null) {\n    logger.warn(\"{} is not a usable ShutdownHookRegister (needs public no-arg ctor)\", className);\n}","typeGuard":"boolean isUsableShutdownHookRegister(Class<?> c) {\n    try {\n        return ShutdownHookRegister.class.isAssignableFrom(c) && c.getConstructor() != null;\n    } catch (NoSuchMethodException e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    return createCustomShutdownHookRegister(className);\n} catch (ReflectiveOperationException | IllegalArgumentException e) {\n    logger.warn(\"Falling back to runtime shutdown hook register\", e);\n    return RUNTIME_SHUTDOWN_HOOK_REGISTER;\n}","preventionTips":["Always give custom ShutdownHookRegister classes a public no-argument constructor.","Write a unit test that instantiates the configured class reflectively.","Check agent logs at startup to confirm which shutdown hook register is active."],"tags":["shutdown-hook","reflection","configuration"],"backgroundTag":"invalid-constructor-argument","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}