我正在使用Java中的数据流作业从Oracle中提取数据。在使用DirectRunner运行数据流作业时,我面临以下错误
jsonPayload:{ 异常:“ java.lang.RuntimeException:org.apache.beam.sdk.util.UserCodeException:java.sql.SQLException:无法创建PoolableConnectionFactory(IO错误:网络适配器无法建立连接) com.google.cloud.dataflow.worker.IntrinsicMapTaskExecutorFactory $ 1.typedApply(IntrinsicMapTaskExecutorFactory.java:192) com.google.cloud.dataflow.worker.IntrinsicMapTaskExecutorFactory $ 1.typedApply(IntrinsicMapTaskExecutorFactory.java:163) 在com.google.cloud.dataflow.worker.graph.Networks $ TypeSafeNodeFunction.apply(Networks.java:63) 在com.google.cloud.dataflow.worker.graph.Networks $ TypeSafeNodeFunction.apply(Networks.java:50) 在com.google.cloud.dataflow.worker.graph.Networks.replaceDirectedNetworkNodes(Networks.java:87) 在com.google.cloud.dataflow.worker.IntrinsicMapTaskExecutorFactory.create(IntrinsicMapTaskExecutorFactory.java:123) 在com.google.cloud.dataflow.worker.BatchDataflowWorker.doWork(BatchDataflowWorker.java:334) 在com.google.cloud.dataflow.worker.BatchDataflowWorker.getAndPerformWork(BatchDataflowWorker.java:288) 在com.google.cloud.dataflow.worker.DataflowBatchWorkerHarness $ WorkerThread.doWork(DataflowBatchWorkerHarness.java:134) 在com.google.cloud.dataflow.worker.DataflowBatchWorkerHarness $ WorkerThread.call处(DataflowBatchWorkerHarness.java:114) com.google.cloud.dataflow.worker.DataflowBatchWorkerHarness $ WorkerThread.call(DataflowBatchWorkerHarness.java:101) 在java.util.concurrent.FutureTask.run(FutureTask.java:266) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) 在java.lang.Thread.run(Thread.java:745) 引起原因:org.apache.beam.sdk.util.UserCodeException:java.sql.SQLException:无法创建PoolableConnectionFactory(IO错误:网络适配器无法建立连接) 在org.apache.beam.sdk.util.UserCodeException.wrap(UserCodeException.java:36) 在org.apache.beam.sdk.io.jdbc.JdbcIO $ ReadFn $ DoFnInvoker.invokeSetup(未知来源) 在com.google.cloud.dataflow.worker.DoFnInstanceManagers $ ConcurrentQueueInstanceManager.deserializeCopy(DoFnInstanceManagers.java:63) 在com.google.cloud.dataflow.worker.DoFnInstanceManagers $ ConcurrentQueueInstanceManager.peek(DoFnInstanceManagers.java:45) 在com.google.cloud.dataflow.worker.UserParDoFnFactory.create(UserParDoFnFactory.java:94) 在com.google.cloud.dataflow.worker.DefaultParDoFnFactory.create(DefaultParDoFnFactory.java:74) 在com.google.cloud.dataflow.worker.IntrinsicMapTaskExecutorFactory.createParDoOperation(IntrinsicMapTaskExecutorFactory.java:262) com.google.cloud.dataflow.worker.IntrinsicMapTaskExecutorFactory.access $ 000(IntrinsicMapTaskExecutorFactory.java:84) com.google.cloud.dataflow.worker.IntrinsicMapTaskExecutorFactory $ 1.typedApply(IntrinsicMapTaskExecutorFactory.java:181) ...另外14个
并获得更多许可。请参考下面的代码 PipelineOptions选项= PipelineOptionsFactory.fromArgs(args).withValidation()。create(); 管道管道= Pipeline.create(options); pipe.apply(JdbcIO。> read()。withDataSourceConfiguration(JdbcIO.DataSourceConfiguration.create(“ oracle.jdbc.driver.OracleDriver”,“ jdbc:oracle:thin:@ //:1521 / orcl”)。withUsername(“ user_name) “).withPassword(” pass_word“))。withQuery(”从供应商中选择SUPPLIER_ID,SUPPLIER_NAME“)。withRowMapper(new JdbcIO.RowMapper>(){ @Override 公共KV mapRow(ResultSet resultSet)引发异常{ System.out.println(“ ====================内部结果集==================== “); KV kv = KV.of(resultSet.getString(“ label”),resultSet.getString(“ name”))); 返回kv } })。withCoder(KvCoder.of(StringUtf8Coder.of(),StringUtf8Coder.of())))。apply(GroupByKey.create())
我也有Oracle版本11g,所以我在这里使用ojdbc6.jar
请帮助我