{"record":{"id":"4cc2199283e0b765","repo":"pentaho/pentaho-kettle","slug":"getnameddatasourcefrommeta-is-not-supported","errorCode":null,"errorMessage":"getNamedDataSourceFromMeta is not supported","messagePattern":"getNamedDataSourceFromMeta is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/database/DataSourceProviderInterface.java","lineNumber":54,"sourceCode":"   * Returns the named data source of respecting its <code>type</code>\n   *\n   * @param datasourceName name of the desired data source\n   * @param type           data source's type\n   * @return named data source\n   * @throws DataSourceNamingException\n   */\n  DataSource getNamedDataSource( String datasourceName, DatasourceType type ) throws DataSourceNamingException;\n\n  /**\n   * Returns the specified data source of respecting its <code>type</code>\n   *\n   * @param dbMeta  definition of the datasource provided via DatabaseMeta\n   * @param type    data source's type\n   * @return named data source\n   * @throws DataSourceNamingException\n   */\n  default DataSource getPooledDataSourceFromMeta( DatabaseMeta dbMeta, DatasourceType type ) throws DataSourceNamingException {\n    throw new UnsupportedOperationException( \"getNamedDataSourceFromMeta is not supported\" );\n  }\n\n  /**\n   * Invalidate the named data source of respecting its <code>type</code>\n   *\n   * @param datasourceName name of the desired data source\n   * @param type           data source's type\n   * @return named data source\n   * @throws DataSourceNamingException\n   */\n  default DataSource invalidateNamedDataSource( String datasourceName, DatasourceType type ) throws DataSourceNamingException {\n    throw new UnsupportedOperationException( \"The invalidateNamedDataSource method was not implemented yet.\" );\n  }\n\n  enum DatasourceType {\n    JNDI, POOLED\n  }\n}","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/database/DataSourceProviderInterface.java#L36-L72","documentation":"DataSourceProviderInterface.getPooledDataSourceFromMeta is a default method whose default implementation throws UnsupportedOperationException. Only providers that actually support pooled data sources override it. Calling getPooledDataSourceFromMeta on a provider that did not override the method hits this stub throw.","triggerScenarios":"Calling getPooledDataSourceFromMeta(dbMeta, DatasourceType.POOLED) via getPoolingDataSource (Database.java) or in tests when the injected DataSourceProviderInterface uses the default implementation instead of overriding it.","commonSituations":"Using a connection pool access type with a custom DataSourceProviderInterface implementation that only implements getNamedDataSourceFromMeta and forgot to override getPooledDataSourceFromMeta; upgrading Pentaho to a version where the interface gained this default method.","solutions":["Override getPooledDataSourceFromMeta in your DataSourceProviderInterface implementation to return a pooled DataSource","Check databaseMeta.isUsingConnectionPool() and avoid the pooled code path if your provider does not support it","If you only need JNDI lookups, ensure access type is TYPE_ACCESS_JNDI so the pooled path is never taken"],"exampleFix":"// before\nclass MyDsProvider implements DataSourceProviderInterface {\n  // getPooledDataSourceFromMeta not overridden -> throws at runtime\n}\n\n// after\nclass MyDsProvider implements DataSourceProviderInterface {\n  @Override\n  public DataSource getPooledDataSourceFromMeta( DatabaseMeta dbMeta, DatasourceType type ) throws DataSourceNamingException {\n    return myPool.getDataSource( dbMeta.getName() );\n  }\n}","handlingStrategy":"try-catch","validationCode":"if ( dsp instanceof DataSourceProviderInterface\n  && dbMeta.isUsingConnectionPool() ) {\n  // ensure provider overrides getPooledDataSourceFromMeta before use\n}","typeGuard":"boolean supportsPooled = dsp.getClass()\n  .getDeclaredMethods().stream()\n  .anyMatch( m -> m.getName().equals( \"getPooledDataSourceFromMeta\" )\n    && m.getDeclaringClass() != DataSourceProviderInterface.class );","tryCatchPattern":"try {\n  DataSource ds = dsp.getPooledDataSourceFromMeta( dbMeta, DatasourceType.POOLED );\n} catch ( UnsupportedOperationException e ) {\n  DataSource ds = dsp.getNamedDataSourceFromMeta( dbMeta.getName(), DatasourceType.JNDI );\n}","preventionTips":["Always override both getPooledDataSourceFromMeta and invalidateNamedDataSource in custom providers","Only enable connection pooling on DatabaseMeta when the provider supports it","Add a unit test exercising the pooled path against your provider"],"tags":["unsupported-operation","database","connection-pool"],"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"}