{"record":{"id":"96b4c4634c9f4b71","repo":"pentaho/pentaho-kettle","slug":"getclass-getname-does-not-support-providing-pooled-data","errorCode":null,"errorMessage":"getClass().getName() + \" does not support providing pooled data sources\"","messagePattern":"getClass\\(\\)\\.getName\\(\\) \\+ \" does not support providing pooled data sources\"","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/database/util/DatabaseUtil.java","lineNumber":188,"sourceCode":"      Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );\n      return DatabaseUtil.getDataSourceFromJndi( datasourceName, new InitialContext() );\n    } catch ( NamingException ex ) {\n      throw new DataSourceNamingException( ex );\n    } finally {\n      Thread.currentThread().setContextClassLoader( original );\n    }\n\n  }\n\n  @Override\n  public DataSource getNamedDataSource( String datasourceName, DatasourceType type )\n    throws DataSourceNamingException {\n    if ( type != null ) {\n      switch ( type ) {\n        case JNDI:\n          return getNamedDataSource( datasourceName );\n        case POOLED:\n          throw new UnsupportedOperationException(\n            getClass().getName() + \" does not support providing pooled data sources\" );\n      }\n    }\n    throw new IllegalArgumentException( \"Unsupported data source type: \" + type );\n  }\n\n  @Override public DataSource invalidateNamedDataSource( String datasourceName, DatasourceType type )\n    throws DataSourceNamingException {\n\n    switch ( type ) {\n      case POOLED:\n        return ConnectionPoolUtil.removeDataSource( datasourceName );\n      default:\n        return FoundDS.remove( datasourceName );\n    }\n  }\n}\n","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/database/util/DatabaseUtil.java#L170-L206","documentation":"The JNDI/POOLED DataSourceProvider implementation of getNamedDataSource(type, name) throws UnsupportedOperationException for DatasourceType.POOLED because this class only resolves datasources through JNDI; it does not manage its own connection pool. The message names the concrete class that lacks the capability.","triggerScenarios":"Calling getNamedDataSource(DatasourceType.POOLED, datasourceName) — via the two-arg overload or the pooled branch of the switch in the single-arg overload's sibling method.","commonSituations":"Code configured with a pooled datasource type but running against the JNDI-based DatabaseUtil provider; swapping provider implementations without updating datasource type configuration; Pentaho code that expects a pooled provider in a JNDI-only deployment.","solutions":["Use DatasourceType.JNDI and ensure the datasource is bound in JNDI instead of requesting POOLED.","Inject/replace with a provider implementation that supports pooled datasources (e.g. one backed by a pool library).","Validate the configured DatasourceType against the provider's capabilities before the call.","Catch UnsupportedOperationException and fall back to a JNDI lookup."],"exampleFix":"// before\nDataSource ds = provider.getNamedDataSource( DatasourceType.POOLED, \"myDs\" );\n// after\nDataSource ds = provider.getNamedDataSource( DatasourceType.JNDI, \"myDs\" );","handlingStrategy":"validation","validationCode":"if ( type == DatasourceType.POOLED ) {\n  throw new IllegalStateException( \"This provider does not support pooled datasources; use JNDI\" );\n}","typeGuard":null,"tryCatchPattern":"try {\n  ds = provider.getNamedDataSource( type, name );\n} catch ( UnsupportedOperationException e ) {\n  ds = provider.getNamedDataSource( DatasourceType.JNDI, name ); // fallback\n}","preventionTips":["Match DatasourceType to the provider implementation actually in use","Assert provider capabilities at startup (fail fast in config validation)","Avoid hardcoding POOLED when deploying the JNDI-based DatabaseUtil"],"tags":["unsupported-operation","datasource","pooling"],"backgroundTag":"unsupported-operation","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"}