{"record":{"id":"033fa15928bd69bd","repo":"pinpoint-apm/pinpoint","slug":"modulefactoryclazzname-modulefactory-initialize","errorCode":null,"errorMessage":"${moduleFactoryClazzName} ModuleFactory initialize fail","messagePattern":"(.+?) ModuleFactory initialize fail","errorType":"exception","errorClass":"PinpointException","httpStatus":null,"severity":"error","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/module/DefaultModuleFactoryResolver.java","lineNumber":76,"sourceCode":"        return DEFAULT_MODULE_FACTORY.equals(moduleFactoryClazzName);\n    }\n\n    @Override\n    public ModuleFactory resolve() {\n        logger.info(\"{} ModuleFactory lookup\", moduleFactoryClazzName);\n        if (isDefaultModuleFactory(moduleFactoryClazzName)) {\n            return new ApplicationContextModuleFactory();\n        }\n\n        ClassLoader classLoader = getClassLoader(DefaultModuleFactoryResolver.class.getClassLoader());\n        try {\n            final Class<? extends ModuleFactory> moduleFactoryClass =\n                    (Class<? extends ModuleFactory>) Class.forName(moduleFactoryClazzName, true, classLoader);\n            Constructor<? extends ModuleFactory> constructor = moduleFactoryClass.getConstructor();\n            return constructor.newInstance();\n        } catch (ReflectiveOperationException ex) {\n            logger.warn(\"{} ModuleFactory initialize fail\", moduleFactoryClazzName, ex);\n            throw new PinpointException(moduleFactoryClazzName + \" ModuleFactory initialize fail\", ex);\n        }\n    }\n\n    private ClassLoader getClassLoader(ClassLoader classLoader) {\n        return Objects.requireNonNull(classLoader, \"can't find classLoader\");\n    }\n\n}\n","sourceCodeStart":58,"sourceCodeEnd":85,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/module/DefaultModuleFactoryResolver.java#L58-L85","documentation":"DefaultModuleFactoryResolver.resolve() loads a ModuleFactory implementation by class name and instantiates it reflectively. Any ReflectiveOperationException is logged and rethrown as PinpointException('<factoryName> ModuleFactory initialize fail'). It indicates the configured module factory could not be created.","triggerScenarios":"Configured profiler.module.factory class name cannot be found (Class.forName fails), has no no-arg constructor, the constructor is inaccessible, or newInstance() throws during construction.","commonSituations":"Typo in the profiler.module.factory config property, custom ModuleFactory jar missing from the agent classpath, or a custom factory whose constructor throws due to bad config.","solutions":["Correct the profiler.module.factory value (use the default factory FQCN shipped with the agent)","If using a custom ModuleFactory, add its jar to the agent classpath and confirm the exact FQCN","Ensure the factory class has a public no-arg constructor","Check the logged WARN stack trace for the root ReflectiveOperationException cause"],"exampleFix":"// before\nprofiler.module.factory=com.mycompany.MyFactory  // jar not deployed\n// after\nprofiler.module.factory=com.navercorp.pinpoint.profiler.context.module.DefaultModuleFactory","handlingStrategy":"validation","validationCode":"String factory = System.getProperty(\"pinpoint.profiler.module.factory\", \"\");\nif (!factory.isEmpty()) {\n    Class.forName(factory, true, agentClassLoader); // fails fast with clear ClassNotFoundException\n}","typeGuard":null,"tryCatchPattern":"try { ModuleFactory f = resolver.resolve(classLoader, factoryName); } catch (PinpointException e) { logger.error(\"ModuleFactory {} failed to initialize\", factoryName, e.getCause()); }","preventionTips":["Copy-paste the factory FQCN from release docs rather than typing it","Custom factories must be public with a no-arg constructor and on the agent classpath","Check the WARN stack trace cause first when this error appears"],"tags":["reflection","config","classloader","pinpoint"],"backgroundTag":"class-not-found","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}