pentaho/pentaho-kettle · error · UnsupportedOperationException

getNamedDataSourceFromMeta is not supported

Error message

getNamedDataSourceFromMeta is not supported

What it means

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.

Solutions

  1. Override getPooledDataSourceFromMeta in your DataSourceProviderInterface implementation to return a pooled DataSource
  2. Check databaseMeta.isUsingConnectionPool() and avoid the pooled code path if your provider does not support it
  3. If you only need JNDI lookups, ensure access type is TYPE_ACCESS_JNDI so the pooled path is never taken

Example fix

// before
class MyDsProvider implements DataSourceProviderInterface {
  // getPooledDataSourceFromMeta not overridden -> throws at runtime
}

// after
class MyDsProvider implements DataSourceProviderInterface {
  @Override
  public DataSource getPooledDataSourceFromMeta( DatabaseMeta dbMeta, DatasourceType type ) throws DataSourceNamingException {
    return myPool.getDataSource( dbMeta.getName() );
  }
}
Defensive patterns

Strategy: try-catch

Validate before calling

if ( dsp instanceof DataSourceProviderInterface
  && dbMeta.isUsingConnectionPool() ) {
  // ensure provider overrides getPooledDataSourceFromMeta before use
}

Type guard

boolean supportsPooled = dsp.getClass()
  .getDeclaredMethods().stream()
  .anyMatch( m -> m.getName().equals( "getPooledDataSourceFromMeta" )
    && m.getDeclaringClass() != DataSourceProviderInterface.class );

Try / catch

try {
  DataSource ds = dsp.getPooledDataSourceFromMeta( dbMeta, DatasourceType.POOLED );
} catch ( UnsupportedOperationException e ) {
  DataSource ds = dsp.getNamedDataSourceFromMeta( dbMeta.getName(), DatasourceType.JNDI );
}

Prevention

When it happens

Trigger: Calling getPooledDataSourceFromMeta(dbMeta, DatasourceType.POOLED) via getPoolingDataSource (Database.java) or in tests when the injected DataSourceProviderInterface uses the default implementation instead of overriding it.

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/4cc2199283e0b765. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/database/DataSourceProviderInterface.java:54

   * Returns the named data source of respecting its <code>type</code>
   *
   * @param datasourceName name of the desired data source
   * @param type           data source's type
   * @return named data source
   * @throws DataSourceNamingException
   */
  DataSource getNamedDataSource( String datasourceName, DatasourceType type ) throws DataSourceNamingException;

  /**
   * Returns the specified data source of respecting its <code>type</code>
   *
   * @param dbMeta  definition of the datasource provided via DatabaseMeta
   * @param type    data source's type
   * @return named data source
   * @throws DataSourceNamingException
   */
  default DataSource getPooledDataSourceFromMeta( DatabaseMeta dbMeta, DatasourceType type ) throws DataSourceNamingException {
    throw new UnsupportedOperationException( "getNamedDataSourceFromMeta is not supported" );
  }

  /**
   * Invalidate the named data source of respecting its <code>type</code>
   *
   * @param datasourceName name of the desired data source
   * @param type           data source's type
   * @return named data source
   * @throws DataSourceNamingException
   */
  default DataSource invalidateNamedDataSource( String datasourceName, DatasourceType type ) throws DataSourceNamingException {
    throw new UnsupportedOperationException( "The invalidateNamedDataSource method was not implemented yet." );
  }

  enum DatasourceType {
    JNDI, POOLED
  }
}

View on GitHub (pinned to f3058517a1)