You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by "Tobi Vollebregt (JIRA)" <ji...@apache.org> on 2017/12/05 17:45:00 UTC
[jira] [Commented] (BEAM-2400) Null pointer exception when creating
a template
[ https://issues.apache.org/jira/browse/BEAM-2400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16278934#comment-16278934 ]
Tobi Vollebregt commented on BEAM-2400:
---------------------------------------
I'm running into this as well.
Turns out that when staging a template with the dataflow runner, you cannot call {{PipelineResult.waitForFinish()}}. So if you have the common {{p.run().waitForFinish();}} then your code throws NullPointerException when staging a template.
Experimentally I found that even something like this:
{code}
PipelineResult result = p.run();
if (!result.getState().isTerminal()) {
result.waitUntilFinish();
}
{code}
will throw, but in this case it gives a more meaningful error:
{code}
Exception in thread "main" java.lang.UnsupportedOperationException: The result of template creation should not be used.
{code}
The only way I've found that will call {{waitUntilFinish}} when running the pipeline, and not call it when staging a template, is:
{code}
PipelineResult result = p.run();
if (options.getTemplateLocation() == null) {
result.waitUntilFinish();
}
{code}
> Null pointer exception when creating a template
> -----------------------------------------------
>
> Key: BEAM-2400
> URL: https://issues.apache.org/jira/browse/BEAM-2400
> Project: Beam
> Issue Type: Bug
> Components: runner-dataflow
> Reporter: Melissa Pashniak
> Priority: Minor
>
> The template is successfully created, but is then followed by a null pointer exception.
> Command:
> mvn compile exec:java -Dexec.mainClass=com.example.WordCount -Dexec.args="--runner=DataflowRunner \
> --project=my-project \
> --stagingLocation=gs://my-bucket/staging \
> --output=gs://my-bucket/output/outputfile \
> --templateLocation=gs://my-bucket/templates/mytemplate"
> INFO: Template successfully created.
> [WARNING]
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.NullPointerException
> at org.apache.beam.runners.dataflow.DataflowPipelineJob.getJobWithRetries(DataflowPipelineJob.java:489)
> at org.apache.beam.runners.dataflow.DataflowPipelineJob.getStateWithRetries(DataflowPipelineJob.java:465)
> at org.apache.beam.runners.dataflow.DataflowPipelineJob.waitUntilFinish(DataflowPipelineJob.java:304)
> at org.apache.beam.runners.dataflow.DataflowPipelineJob.waitUntilFinish(DataflowPipelineJob.java:240)
> at org.apache.beam.runners.dataflow.DataflowPipelineJob.waitUntilFinish(DataflowPipelineJob.java:193)
> at org.apache.beam.runners.dataflow.DataflowPipelineJob.waitUntilFinish(DataflowPipelineJob.java:186)
> at com.example.WordCount.main(WordCount.java:184)
> ... 6 more
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)