[
https://issues.apache.org/jira/browse/BEAM-2223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16003401#comment-16003401
]
ASF GitHub Bot commented on BEAM-2223:
--------------------------------------
GitHub user kennknowles opened a pull request:
https://github.com/apache/beam/pull/2999
[BEAM-2223] Do not register TestSparkPipelineOptions to avoid hard hamcrest
dep
Be sure to do all of the following to help us incorporate your contribution
quickly and easily:
- [ ] Make sure the PR title is formatted like:
`[BEAM-<Jira issue #>] Description of pull request`
- [ ] Make sure tests pass via `mvn clean verify`.
- [ ] Replace `<Jira issue #>` in the title with the actual Jira issue
number, if there is one.
- [ ] If this contribution is large, please file an Apache
[Individual Contributor License
Agreement](https://www.apache.org/licenses/icla.pdf).
---
We have an undocumented requirement that no subclass of
`TestPipelineOptions` can be registered. We do not indicate a hard dependency
on hamcrest, but test options has one and it will crash on registration (or
classloading in general) if the user does not provide it.
I see this change as a short term solution, making the Spark registrar
analogous to all the other runners. It allows Java 8 examples to get past the
point of registration.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/kennknowles/beam java8-examples
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/beam/pull/2999.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2999
----
commit 847c90f93efb77d4d05284ca6855ebbd936c8e3a
Author: Kenneth Knowles <[email protected]>
Date: 2017-05-09T19:44:19Z
Do not register TestSparkPipelineOptions to avoid hard hamcrest dep
----
> java8 examples are not running
> ------------------------------
>
> Key: BEAM-2223
> URL: https://issues.apache.org/jira/browse/BEAM-2223
> Project: Beam
> Issue Type: Bug
> Components: examples-java
> Reporter: Ahmet Altay
> Assignee: Kenneth Knowles
> Fix For: 2.0.0
>
>
> Could not run java8 examples any more with:
> {code}
> mvn compile exec:java
> -Dexec.mainClass=org.apache.beam.examples.complete.game.UserScore
> -Dexec.args="--project=<MYPROJECT> --dataset=<MYDATASET>
> --tempLocation=<MY_GCS_TEMP_LOCATION>"
> {code}
> Fails with:
> {code}
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:294)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.NoClassDefFoundError: org/hamcrest/Matcher
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> at java.lang.Class.getDeclaredMethods0(Native Method)
> at java.lang.Class.privateGetDeclaredMethods(Class.java:2703)
> at java.lang.Class.privateGetPublicMethods(Class.java:2904)
> at java.lang.Class.privateGetPublicMethods(Class.java:2913)
> at java.lang.Class.getMethods(Class.java:1617)
> at sun.misc.ProxyGenerator.generateClassFile(ProxyGenerator.java:451)
> at sun.misc.ProxyGenerator.generateProxyClass(ProxyGenerator.java:339)
> at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:639)
> at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:557)
> at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230)
> at java.lang.reflect.WeakCache.get(WeakCache.java:127)
> at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:419)
> at java.lang.reflect.Proxy.getProxyClass(Proxy.java:371)
> at
> org.apache.beam.sdk.options.PipelineOptionsFactory.validateWellFormed(PipelineOptionsFactory.java:606)
> at
> org.apache.beam.sdk.options.PipelineOptionsFactory.register(PipelineOptionsFactory.java:544)
> at
> org.apache.beam.sdk.options.PipelineOptionsFactory.initializeRegistry(PipelineOptionsFactory.java:570)
> at
> org.apache.beam.sdk.options.PipelineOptionsFactory.<clinit>(PipelineOptionsFactory.java:519)
> at
> org.apache.beam.examples.complete.game.UserScore.main(UserScore.java:226)
> ... 6 more
> Caused by: java.lang.ClassNotFoundException: org.hamcrest.Matcher
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> ... 35 more
> {code}
> cc: [~kenn][~tgroh][~vikasrk][[email protected]]
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)