我正在使用Direct Runner使用Netezza JDBC驱动程序从Netezza读取数据。我收到以下异常-org.apache.beam.sdk.util.UserCodeException:java.lang.AbstractMethodError:org.netezza.sql.NzConnection.isValid(I)Z。可能是什么分辨率?
下面的示例代码:
PCollection<KV<String, String>> a = pipeline.apply(JdbcIO.<KV<String, String>>read()
.withCoder(KvCoder.of(StringUtf8Coder.of(), StringUtf8Coder.of()))
.withDataSourceConfiguration(JdbcIO.DataSourceConfiguration.create(
"org.netezza.Driver", "jdbc:netezza://<server name>:<port>/<databasename>")
.withUsername("<username>")
.withPassword("<password>"))
.withQuery("select column1,column2 from tmp_table")
.withRowMapper(new JdbcIO.RowMapper<KV<String, String>>() {
@Override
public KV<String, String> mapRow(ResultSet resultSet) throws Exception {
System.out.println("Rows" + resultSet.getString(1) + resultSet.getString(2));
return KV.of(resultSet.getString(1), resultSet.getString(2));
}
})
);
例外:
Caused by: org.apache.beam.sdk.util.UserCodeException: java.lang.AbstractMethodError: org.netezza.sql.NzConnection.isValid(I)Z
at org.apache.beam.sdk.util.UserCodeException.wrap(UserCodeException.java:36)
at org.apache.beam.sdk.io.jdbc.JdbcIO$ReadFn$DoFnInvoker.invokeSetup(Unknown Source)
at org.apache.beam.runners.direct.DoFnLifecycleManager$DeserializingCacheLoader.load(DoFnLifecycleManager.java:102)
at org.apache.beam.runners.direct.DoFnLifecycleManager$DeserializingCacheLoader.load(DoFnLifecycleManager.java:91)
at org.apache.beam.repackaged.beam_runners_direct_java.com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3628)
at org.apache.beam.repackaged.beam_runners_direct_java.com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2336)
at org.apache.beam.repackaged.beam_runners_direct_java.com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2295)
at org.apache.beam.repackaged.beam_runners_direct_java.com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2208)
... 13 more
Caused by: java.lang.AbstractMethodError: org.netezza.sql.NzConnection.isValid(I)Z
at org.apache.commons.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:918)
at org.apache.commons.dbcp2.PoolableConnection.validate(PoolableConnection.java:283)
at org.apache.commons.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:357)
at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2307)
at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2290)
at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2039)
at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1533)
at org.apache.commons.dbcp2.DataSourceConnectionFactory.createConnection(DataSourceConnectionFactory.java:44)
at org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:256)
at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.j