{"record":{"id":"d66fdb7c9c77382b","repo":"pentaho/pentaho-kettle","slug":"unable-to-get-instance-of-plugin-type-plugintypeclass","errorCode":null,"errorMessage":"Unable to get instance of plugin type: ${pluginTypeClass}","messagePattern":"Unable to get instance of plugin type: (.+?)","errorType":"exception","errorClass":"KettlePluginException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/plugins/PluginRegistry.java","lineNumber":1043,"sourceCode":"      Map<PluginInterface, URLClassLoader> classLoaders =\n        classLoaderMap.computeIfAbsent( plugin.getPluginType(), k -> new HashMap<>() );\n      classLoaders.put( plugin, ucl );\n    } finally {\n      lock.writeLock().unlock();\n    }\n  }\n\n  public PluginTypeInterface getPluginType( Class<? extends PluginTypeInterface> pluginTypeClass )\n      throws KettlePluginException {\n    try {\n      // All these plugin type interfaces are singletons...\n      // So we should call a static getInstance() method...\n      //\n      Method method = pluginTypeClass.getMethod( \"getInstance\", new Class<?>[0] );\n\n      return (PluginTypeInterface) method.invoke( null, new Object[0] );\n    } catch ( Exception e ) {\n      throw new KettlePluginException( \"Unable to get instance of plugin type: \" + pluginTypeClass.getName(), e );\n    }\n  }\n\n  public List<PluginInterface> findPluginsByFolder( URL folder ) {\n    String path = folder.getPath();\n    try {\n      path = folder.toURI().normalize().getPath();\n    } catch ( URISyntaxException e ) {\n      log.logError( e.getLocalizedMessage(), e );\n    }\n    if ( path.endsWith( \"/\" ) ) {\n      path = path.substring( 0, path.length() - 1 );\n    }\n    List<PluginInterface> result = new ArrayList<PluginInterface>();\n    lock.readLock().lock();\n    try {\n      for ( Set<PluginInterface> typeInterfaces : pluginMap.values() ) {\n        for ( PluginInterface plugin : typeInterfaces ) {","sourceCodeStart":1025,"sourceCodeEnd":1061,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/plugins/PluginRegistry.java#L1025-L1061","documentation":"KettlePluginException thrown by PluginRegistry.getPluginType when the plugin-type class cannot be instantiated via its static getInstance() method. The registry expects every PluginTypeInterface implementation to expose a no-arg static getInstance(); reflection failures (missing method, constructor throwing, illegal access, class not loadable) are wrapped here.","triggerScenarios":"Calling PluginRegistry.getPluginType(SomePluginType.class) when the class has no static getInstance() method, its classloader cannot load it (ClassNotFoundException inside invoke/lookup), getInstance() itself throws, or the class isn't accessible via reflection.","commonSituations":"Custom plugin type implemented without the required static getInstance() method; class name typo when registering/looking up the plugin type; plugin jar not on the classpath so the type class fails to load; old plugin type compiled against a different Kettle API version.","solutions":["Add/fix the required public static getInstance() no-arg method on the plugin type class (e.g. public static MyPluginType getInstance() { return instance; })","Verify the plugin type class is on the classpath and the fully-qualified name is correct","Read the wrapped cause: NoSuchMethodException means missing getInstance, ExceptionInInitializerError means the singleton constructor threw","Rebuild the plugin against the same Kettle/PDI version in use"],"exampleFix":"// before\nclass MyPluginType implements PluginTypeInterface { public MyPluginType() {...} } // no getInstance\n// after\nclass MyPluginType implements PluginTypeInterface {\n  private static final MyPluginType instance = new MyPluginType();\n  public static MyPluginType getInstance() { return instance; }\n}","handlingStrategy":"validation","validationCode":"Class<?> t = MyPluginType.class;\nboolean ok = PluginTypeInterface.class.isAssignableFrom(t);\ntry {\n  t.getMethod(\"getInstance\");\n} catch ( NoSuchMethodException e ) {\n  throw new IllegalStateException(t.getName() + \" lacks static getInstance()\");\n}","typeGuard":"static boolean isValidPluginType(Class<? extends PluginTypeInterface> t) {\n  try { t.getMethod(\"getInstance\"); return true; }\n  catch ( NoSuchMethodException e ) { return false; }\n}","tryCatchPattern":"try {\n  PluginTypeInterface type = PluginRegistry.init().getPluginType(MyPluginType.class);\n} catch ( KettlePluginException e ) {\n  // cause is NoSuchMethodException | ClassNotFoundException | InvocationTargetException\n  log.error(\"Cannot instantiate plugin type: \" + e.getCause(), e.getCause());\n}","preventionTips":["Always implement public static getInstance() on custom plugin types","Keep plugin type FQCNs correct in registrations and code","Ensure all plugin type jars are on the classpath before registry init","Compile plugins against the exact PDI version deployed"],"tags":["java","reflection","plugin-system"],"backgroundTag":"class-not-found","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}