Apache Beam: Exceptions after upgrade to 2.5.0 - google-cloud-dataflow

Java version: 8
Runner: Dataflow
Everything worked before I upgrade to beam 2.5.0. Exception:
Exception in thread "main" java.lang.RuntimeException: Failed to construct instance from factory method DataflowRunner#fromOptions(interface org.apache.beam.sdk.options.PipelineOptions)
at org.apache.beam.sdk.util.InstanceBuilder.buildFromMethod(InstanceBuilder.java:233)
at org.apache.beam.sdk.util.InstanceBuilder.build(InstanceBuilder.java:162)
at org.apache.beam.sdk.PipelineRunner.fromOptions(PipelineRunner.java:55)
at org.apache.beam.sdk.Pipeline.create(Pipeline.java:150)
at com.geotab.bigdata.streaming.mapserver.backfill.MapServerBatchBeamApplication.main(MapServerBatchBeamApplication.java:115)
Caused by: 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.apache.beam.sdk.util.InstanceBuilder.buildFromMethod(InstanceBuilder.java:222)
... 4 more
Caused by: java.lang.NoSuchMethodError: com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient$Builder.setBatchPath(Ljava/lang/String;)Lcom/google/api/client/googleapis/services/AbstractGoogleClient$Builder;
at com.google.api.services.storage.Storage$Builder.setBatchPath(Storage.java:9307)
at com.google.api.services.storage.Storage$Builder.<init>(Storage.java:9286)
at org.apache.beam.sdk.util.Transport.newStorageClient(Transport.java:95)
at org.apache.beam.sdk.util.GcsUtil$GcsUtilFactory.create(GcsUtil.java:96)
at org.apache.beam.sdk.util.GcsUtil$GcsUtilFactory.create(GcsUtil.java:84)
at org.apache.beam.sdk.options.ProxyInvocationHandler.returnDefaultHelper(ProxyInvocationHandler.java:592)
at org.apache.beam.sdk.options.ProxyInvocationHandler.getDefault(ProxyInvocationHandler.java:533)
at org.apache.beam.sdk.options.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:155)
at com.sun.proxy.$Proxy25.getGcsUtil(Unknown Source)
at org.apache.beam.sdk.extensions.gcp.storage.GcsPathValidator.verifyPathIsAccessible(GcsPathValidator.java:88)
at org.apache.beam.sdk.extensions.gcp.storage.GcsPathValidator.validateOutputFilePrefixSupported(GcsPathValidator.java:61)
my gradle config:
dependencies {
compile 'org.apache.beam:beam-runners-direct-java:2.5.0'
compile 'org.apache.beam:beam-runners-reference-parent:2.4.0'
compile 'org.apache.beam:beam-runners-reference-java:2.5.0'
compile ('org.apache.beam:beam-runners-google-cloud-dataflow-java:2.5.0') {
exclude group: 'com.google.guava'
}
compile ('com.google.api-client:google-api-client:1.22.0') {
force = true //version 1.23.0 causes HTTP response 404 not found exception in Beam
//Is this still the case? Which version should I use with beam 2.5.0?
exclude group: 'com.google.guava'
}
compile 'com.google.guava:guava:23.0'
compile 'com.typesafe:config:1.3.2'
compile 'org.apache.httpcomponents:httpclient:4.5.5'
}
Side questions are:
Which google-api-client version is compatible with beam 2.5?
Which com.google.guava:guava version is compatible for beam and google-api-client?

Cloud Dataflow SDK 2.5.0 for Java has the following compile and runtime dependencies:
+-----------------------+-------------------+----------+
| GroupId | ArtifactId | Version |
+-----------------------+-------------------+----------+
| com.google.api-client | google-api-client | 1.23.0 |
| com.google.guava | guava | 20.0 |
+-----------------------+-------------------+----------+

The error indicates that AbstractGoogleClient.Builder is missing. Checking the documentation for the google-api-java-client versions, this was present in 1.19 and 1.20, but from 1.21 onward is not to be found.
According to this GitHub issue report, updating to at least 1.23 solves those kinds of problems. Note also this comment from Nilson Pontello: "You must make a clean build after changing from 1.22.0 to 1.23.0 otherwise old libs will still be used, specially if you are generating war files using maven."

Related

NoClassDefFoundError on grails run-app (Grails 2.5.0)

When I try to run a freshly created project using Grails 2.5.0:
$ grails create-app test250
$ cd test250
$ grails run-app
I get the following error:
| Running Grails application
| Error java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
| Error at org.grails.plugins.tomcat.fork.ForkedTomcatServer.<clinit>(ForkedTomcatServer.groovy:44)
| Error Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
| Error at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
| Error at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
| Error at java.security.AccessController.doPrivileged(Native Method)
| Error at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
| Error at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
| Error at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
| Error at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
| Error ... 1 more
Exception in thread "main"
| Error Forked Grails VM exited with error
My machine is running OSX 10.10.2 and I have several projects running on Grails 2.2.5 without problems.
It looks like the problem is that commons-logging is indirectly used by the Tomcat plugin (ForkedTomcatServer extends the Grails ForkedGrailsProcess class which references org.apache.commons.logging.Log) but it's not exported, and it's not a Grails dependency.
It is an indirect dependency of the asset-pipeline plugin, so that should make the jar available and work around the bug for most users. Did you remove asset-pipeline as a dependent plugin in BuildConfig.groovy?
You should be able to get things working by explicitly adding a dependency for commons-logging in BuildConfig.groovy:
dependencies {
runtime 'commons-logging:commons-logging:1.2'
...
}
The problem was solved using GVM (as pointed by Jeff) to manage the different Grails versions installed on my machine.

Cannot build maven application on Jenkins with JDK1.5

I am trying to build a maven 2.2.1 project on Jenkins ver. 1.596. The project uses JDK 1.5 and it is not an option to upgrade to a newer JDK.
When building the project I get the following stacktrace:
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
at hudson.maven.agent.Main.main(Main.java:143)
at hudson.maven.agent.Main.main(Main.java:68)
I have seen a lot of posts about this issue with Jenkins and JDK1.5, but noone has come up with a solution. Hope that somebody has found a workaround.
Regards
Steffen

What is the right way to add apache-tika dependency into grails project

When using tika-1.4 getting this:
Caused by: java.lang.NoClassDefFoundError: net/sf/cglib/core/DebuggingClassWriter
at net.sf.cglib.core.DefaultGeneratorStrategy.getClassWriter(DefaultGeneratorStrategy.java:30)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:144)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:116)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
... 5 more
Caused by: java.lang.ClassNotFoundException: net.sf.cglib.core.DebuggingClassWriter
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Added these two lines into BuildConfig.groovy:
compile ("org.apache.tika:tika-core:1.4")
compile ("org.apache.tika:tika-parsers:1.4") {excludes "tika-core"}
If I don't exclude tika-core from tika-parsers, I'm getting 2 versions of tika-core (version 1.0 pulled by vorbis-java-tika dependency) and version tika-core version 1.4.
If I replace tika version to be 1.3, exception is gone.
UPDATE 1
This solution seems works:
compile ("org.apache.tika:tika-core:${tikaVersion}")
compile ("org.apache.tika:tika-parsers:${tikaVersion}") { excludes "tika-core", "commons-codec", "commons-logging", "slf4j-api" }
This may or may not be the issue you're seeing -- we're working with tika 1.5 (snapshot). That version pulls in asm-debug-all, which was the cause of our troubles (similar stacktrace to yours). Try using 'asm-debug-all' in your tika-parsers excludes instead of 'tika-core'.

installing a local dojo plugin on grails 2.2.3

I'm trying to install a dojo plugin plugin from a local directory, but I get a grails error:
plugin not found.
The problem is that I try to do something kind new for using the dojo 1.9 librery. I am using Ubuntu 10.04, 64 bit architecture, and the Spring IDE GGSTS. I am trying to install default dojo plugin (1.7) on grails from the internet that downloads the plugin to a local directory. The thing lay on the modification of the related plugin, uncompressed it, change the dojo library on web-app/js/dojo directory for the update one dojo 1.9. files. Then uninstall dojo plugin, remove the dojo cache on .grails/ivy-cache/org.grails.pluggin/ and on the .grails/GRAILS_VERSION/project/_PROJECT. After these, only rest the modified plugin installation by install-plugin command. The problem is that grails return an error:
plugin () not found
Loading Grails 2.2.3
| Configuring classpath.
| Environment set to development.....
| Warning The install-plugin command is deprecated and may be removed from a future version of Grails. Plugin dependencies should be expressed in grails-app/conf/BuildConfig.groovy. See http://grails.org/doc/2.2.x/guide/conf.html#pluginDependencies.
| Resolving plugin /home/israel/dojo-1.7.2.0.zip. Please wait...
| Error resolving plugin [name:/home/israel/dojo-1.7.2.0.zip, group:org.grails.plugins, version:latest.integration]. Plugin not found.
| Error Plugin not found for name [/home/israel/dojo-1.7.2.0.zip] and version [not specified]
| Error Error installing plugin: null (Use --stacktrace to see the full trace)
| Error org.codehaus.groovy.grails.cli.ScriptExitException
| Error at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
| Error at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
| Error at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
| Error at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
| Error at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
| Error at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:194)
| Error at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error at java.lang.reflect.Method.invoke(Method.java:616)
| Error at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:272)
| Error at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:64)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
| Error at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
...
With current Grails version 2.2.3 you are using, install-plugin has been deprecated. You need to define it in your buildConfig. If you have the plugin in maven repository just define it in plugins dsl otherwise you need to define it inline using grails.plugin.location here. Take a look at creating and installing plugins.

Grails not running

I am trying to run grails in my laptop, I have installed jdk 1.8.0 and jre8, I have set JAVA_HOME and GRAILS_HOME correctly. When I type %JAVA_HOME% or %GRAILS_HOME% in command prompt, it displays correct paths. But when I try to run any grails command, I get the following error:
| Loading Grails 2.1.1
| Error java.lang.reflect.InvocationTargetException
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error at java.lang.reflect.Method.invoke(Method.java:491)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error at java.lang.reflect.Method.invoke(Method.java:491)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
| Error Caused by: java.lang.NullPointerException: Cannot invoke method getAt() on null object
| Error at grails.util.BuildSettings.configureDependencyManager(BuildSettings.groovy:1208)
| Error at grails.util.BuildSettings$configureDependencyManager.callCurrent(Unknown Source)
| Error at grails.util.BuildSettings.postLoadConfig(BuildSettings.groovy:1121)
| Error at grails.util.BuildSettings.loadConfig(BuildSettings.groovy:1003)
| Error at grails.util.BuildSettings$loadConfig.callCurrent(Unknown Source)
| Error at grails.util.BuildSettings.loadConfig(BuildSettings.groovy:978)
My laptop has windows 8.
Any help regarding this would be greatly appreciated.
I was using java8, I tried using java7 and it worked fine! Apparently grails does not work with java8
grails 2.4 works with jdk - 8. grails 2.1.1 works with jdk - 7.
Switch to Grails 2.5.0 to run on jdk8u40+.
Also, if you are using the IDE GGTS, make sure it is v3.6.4, and that you install Groovy 2.4 from the extensions page to get the show on the road.
for my case, I re-synced the JDK home link. I use quite a few java versions these days.
after install the intrusive jdk1.8.0_51. THE /Library/Java/Home get overridden (maybe in most cases intended). if you just want to play with jdk1.8 and works mainly under other versions, you should link this place back
Now Grails 3+ version support java8 and there are lots of feature with new build system and also integrated spring boot. So you can update your project with grails 3+ version. But you need to Change your application architecture cause of spring boot and gradle build system.

Resources