DataflowTemplates icon indicating copy to clipboard operation
DataflowTemplates copied to clipboard

[Bug]: Build error for DatastoreToPubsub

Open ggprod opened this issue 3 years ago • 1 comments

Related Template(s)

DatastoreToPubsub

What happened?

tried to build the template with the command:

mvn compile exec:java -Dexec.mainClass=com.google.cloud.teleport.templates.DatastoreToPubsub -Dexec.cleanupDaemonThreads=false -Dexec.args=" \
--project=tealbook-dev --stagingLocation=gs://tealbook-dev-dataflow/staging --tempLocation=gs://tealbook-dev-dataflow/temp --templateLocation=gs://tealbook-dev-dataflow/templates/DatastoreToPubsub.json --runner=DataflowRunner"

and got the error:

java.lang.IllegalArgumentException: Please mark non-public interface com.google.cloud.teleport.templates.DatastoreToPubsub$DatastoreToPubsubOptions as public. The JVM requires that all non-public interfaces to be in the same package which will prevent the PipelineOptions proxy class to implement all of the interfaces.
    at org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkArgument (Preconditions.java:216)
    at org.apache.beam.sdk.options.PipelineOptionsFactory.validateClass (PipelineOptionsFactory.java:994)
    at org.apache.beam.sdk.options.PipelineOptionsFactory.access$2500 (PipelineOptionsFactory.java:144)
    at org.apache.beam.sdk.options.PipelineOptionsFactory$Cache.validateWellFormed (PipelineOptionsFactory.java:2164)
    at org.apache.beam.sdk.options.PipelineOptionsFactory$Cache.validateWellFormed (PipelineOptionsFactory.java:2104)
    at org.apache.beam.sdk.options.PipelineOptionsFactory$Cache.access$800 (PipelineOptionsFactory.java:2043)
    at org.apache.beam.sdk.options.PipelineOptionsFactory.parseObjects (PipelineOptionsFactory.java:1858)
    at org.apache.beam.sdk.options.PipelineOptionsFactory.access$400 (PipelineOptionsFactory.java:144)
    at org.apache.beam.sdk.options.PipelineOptionsFactory$Builder.as (PipelineOptionsFactory.java:327)
    at com.google.cloud.teleport.templates.DatastoreToPubsub.main (DatastoreToPubsub.java:47)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:282)
    at java.lang.Thread.run (Thread.java:829)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  10:57 min
[INFO] Finished at: 2022-05-01T16:29:30Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project google-cloud-teleport-java: An exception occured while executing the Java class. Please mark non-public interface com.google.cloud.teleport.templates.DatastoreToPubsub$DatastoreToPubsubOptions as public. The JVM requires that all non-public interfaces to be in the same package which will prevent the PipelineOptions proxy class to implement all of the interfaces. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Beam Version

Newer than 2.35.0

Relevant log output

java.lang.IllegalArgumentException: Please mark non-public interface com.google.cloud.teleport.templates.DatastoreToPubsub$DatastoreToPubsubOptions as public. The JVM requires that all non-public interfaces to be in the same package which will prevent the PipelineOptions proxy class to implement all of the interfaces.
    at org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkArgument (Preconditions.java:216)
    at org.apache.beam.sdk.options.PipelineOptionsFactory.validateClass (PipelineOptionsFactory.java:994)
    at org.apache.beam.sdk.options.PipelineOptionsFactory.access$2500 (PipelineOptionsFactory.java:144)
    at org.apache.beam.sdk.options.PipelineOptionsFactory$Cache.validateWellFormed (PipelineOptionsFactory.java:2164)
    at org.apache.beam.sdk.options.PipelineOptionsFactory$Cache.validateWellFormed (PipelineOptionsFactory.java:2104)
    at org.apache.beam.sdk.options.PipelineOptionsFactory$Cache.access$800 (PipelineOptionsFactory.java:2043)
    at org.apache.beam.sdk.options.PipelineOptionsFactory.parseObjects (PipelineOptionsFactory.java:1858)
    at org.apache.beam.sdk.options.PipelineOptionsFactory.access$400 (PipelineOptionsFactory.java:144)
    at org.apache.beam.sdk.options.PipelineOptionsFactory$Builder.as (PipelineOptionsFactory.java:327)
    at com.google.cloud.teleport.templates.DatastoreToPubsub.main (DatastoreToPubsub.java:47)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:282)
    at java.lang.Thread.run (Thread.java:829)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  10:57 min
[INFO] Finished at: 2022-05-01T16:29:30Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project google-cloud-teleport-java: An exception occured while executing the Java class. Please mark non-public interface com.google.cloud.teleport.templates.DatastoreToPubsub$DatastoreToPubsubOptions as public. The JVM requires that all non-public interfaces to be in the same package which will prevent the PipelineOptions proxy class to implement all of the interfaces. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

ggprod avatar May 01 '22 16:05 ggprod

build error seems to resolve when the public keyword is added for the DatastoreToPubsubOptions interface in the DatastoreToPubsubOptions class

ggprod avatar May 01 '22 16:05 ggprod