Error Launching CloudDataFlow Java App using Cloud Composer - google-cloud-dataflow

Am a GCP Newbie and facing an error when trying to run a cloud data flow app for the BeamTutorial using GCP Cloud Composers DataflowJavaOperator. Airflow picks up the pipeline but fails with the below error.
gcp_dataflow_hook.py:115} INFO - Running command: java -cp /tmp/dataflow13ec2a50-BeamTutorial-0.0.1-SNAPSHOT.jar org.apache.beam.examples.tutorial.game.solution.Exercise2 --runner=DataflowRunner --project=..... --region=us-central1 --labels={"airflow-version":"v1-9-0-composer"} --jobName=run-beam-data-flow-java-1449a1da --outputPrefix=gs://..../ex2-spark/out
gcp_dataflow_hook.py:127} WARNING - Error: A JNI error has occurred, please check your installation and try again
[2018-10-18 09:35:00,316] {base_task_runner.py:98} INFO - Subtask: Exception in thread "main" java.lang.NoClassDefFoundError:org/apache/beam/sdk/options/PipelineOptions
This BeamTutorial-0.0.1-SNAPSHOT.jar is not a fat jar and runs the job successfully in Dataflow when submitted manually from gcp cloud shell manually as below
mvn compile exec:java -Dexec.mainClass="org.apache.beam.examples.tutorial.game.solution.Exercise2" -Dexec.args="--runner=dataflow --project=<project-name> --outputPrefix=gs://..../beam-tutorial/ex2-spark/out" -Pdataflow-runner
Appreciate any help in fixing this error. thank you.

When using the DataFlowJavaOperator you need to follow instructions here on how to create your ".jar" file:
Add the dependency and plugin from link
Run mvn package to create your ".jar" file
Once you do that I'd advise to make sure that the ".jar" file is actually running correctly before trying to run it inside Composer. So in this case following the tutorial, running:
java -jar target/BeamTutorial-0.0.1-SNAPSHOT.jar --runner=DataflowRunner --p
roject=<my-project> --tempLocation=<my-bucket>
I also get:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/beam/sdk/options/PipelineOptions
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.apache.beam.sdk.options.PipelineOptions
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
So the issue looks more Java-related and how the pom is configured that is not creating a valid .jar file, or it is expecting some additional parameters. In any case you should troubleshoot the ".jar"/pom before going further.
For some other pipelines I have I ran them successfully using the DataflowJavaOperator and a valid ".jar" file.

Related

SonarQube Scanner Error while running the sonar qube from Jenkins build pipeline

Part of the Jenkins build pipeline we were running the sonar qube code scan and was working fine, only few days ago it started throwing error as mentioned below
Sonar Qube version: 6.7.6 (build 38781)
Sonar Scanner version: sonar-scanner-3.3.0.1492-windows
(Env variable) SONAR_SCANNER : C:\sonar-scanner-3.3.0.1492-windows
00:44:26.810 ERROR: Error during SonarQube Scanner execution
00:44:26.810 ERROR: Unable to load component class org.sonar.scanner.bootstrap.ScannerPluginInstaller
00:44:26.810 ERROR: Caused by: Unable to load component class org.sonar.home.cache.FileCache
00:44:26.810 ERROR: Caused by: Unable to load component class org.sonar.scanner.bootstrap.GlobalConfiguration
00:44:26.810 ERROR: Caused by: Not authorized. Please check the properties sonar.login and sonar.password.
We cannot upgrade to newer version , I would like to understand what is causing the issue for Sonar to fail. Appreciate your responses.
From Admin page (Sonarqube) give access to use to run execute sonar analysis and then
generate login token from UI .
_ **use propertyb in sonar.properties file** _
sonar.login=token

How to Setup Sonarcube scanner for Xcode/Objective-C iOS Project

I am new to SonarQube. I find the documents given in the portal has very less information about setting it up in Xcode/Objective-C. Can anyone help in instructions for Setting/Installing sonarQube scanner.
I use this below steps for Android project. I need the steps for iOS which I am not able to find
1. Copy sonar cube from LS Path : \\ipaddress\Mobility\LS\Tools\Sonar
2. Paste it in C:\Program Files (x86)\
3. Run sonar-runner
4. Set Environment variable path: C:\Program Files (x86)\sonar-runner-2.4\bin
5. Configure Project : Example :
sonar.projectName=
sonar.projectKey=
sonar.host.url=
sonar.sources=app/src/main/java/
sonar.login=
sonar.password=
sonar.projectVersion=
in sonar-project file.
6. Paste that file inside our project folder
7. Open command prompt and go to projectso path.
7. copy paste the following in command prompt:
sonar-scanner -Dsonar.sources=app/src -Dsonar.java.binaries=app/build/outputs/apk -Dsonar.java.libraries=app/libs/*.jar
I am getting the below error
ERROR: Error during SonarQube Scanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to
execute SonarQube at
org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:84)
at
org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:71)
at java.base/java.security.AccessController.doPrivileged(Native
Method) at
org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:71)
at
org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:67)
at
org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:218)
at
org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:156)
at org.sonarsource.scanner.cli.Main.execute(Main.java:74) at
org.sonarsource.scanner.cli.Main.main(Main.java:61) Caused by:
java.lang.IllegalStateException: Fail to get bootstrap index from
server at
org.sonarsource.scanner.api.internal.Jars.getBootstrapIndex(Jars.java:100)
at
org.sonarsource.scanner.api.internal.Jars.getScannerEngineFiles(Jars.java:76)
at org.sonarsource.scanner.api.internal.Jars.download(Jars.java:70)
at
org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:39)
at
org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:75)
... 8 more Caused by: java.lang.IllegalStateException: Status
returned by url [http://ipaddress/batch/index] is not valid:
[407] at
org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:115)
at
org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:98)
at
org.sonarsource.scanner.api.internal.Jars.getBootstrapIndex(Jars.java:96)
... 12 more ERROR:

MobileFirst Server - Application Center Configure Ant Task (configure-appcenter-liberty-mysql.xml) Error

I'm trying to install & configure the application center for MobileFirst Server using the ant task to install. Prior to the install task I was able to use the database task to create necessary tables in the app center database.
I get the error mentioned in the logs below when running
ant -f configure-appcenter-liberty-mysql.xml install
Ref
https://www.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.installconfig.doc/appcenter/t_ac_deploy_cons_serv_ant_tasks.html?lang=en
Ant Script Output
root#ubuntu:/opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples# sudo ant -v -f configure-appcenter-liberty-mysql-edited.xml install
Apache Ant(TM) version 1.9.3 compiled on April 8 2014
Buildfile: /opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples/configure-appcenter-liberty-mysql-edited.xml
Detected Java version: 1.7 in: /usr/lib/jvm/java-7-openjdk-amd64/jre
Detected OS: Linux
parsing buildfile /opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples/configure-appcenter-liberty-mysql-edited.xml with URI = file:/opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples/configure-appcenter-liberty-mysql-edited.xml
Project base dir set to: /opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples
parsing buildfile jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
Build sequence for target(s) `install' is [install]
Complete build sequence is [install, help, minimal-update, databases, uninstall, ]
install:
[installApplicationCenter] Logging output of task <installApplicationCenter> to file /root/.mobilefirst_platform_server/configuration-logs/installApplicationCenter_2016_04_20_22_42_09.log
[installApplicationCenter] Copying /opt/IBM/MobileFirst_Platform_Server/tools/mysql-connector-java-5.1.38/mysql-connector-java-5.1.38-bin.jar to /opt/IBM/WebSphere/Liberty/usr/shared/resources/mysql/mysql-connector-java-5.1.38-bin.jar
[installApplicationCenter] Copying /opt/IBM/MobileFirst_Platform_Server/tools/mysql-connector-java-5.1.38/mysql-connector-java-5.1.38-bin.jar to /opt/IBM/WebSphere/Liberty/usr/shared/resources/mysql/mysql-connector-java-5.1.38-bin.jar
[installApplicationCenter] Copying /opt/IBM/WebSphere/Liberty/usr/servers/simpleServer/server.xml to /opt/IBM/WebSphere/Liberty/usr/servers/simpleServer/server.xml.bak2
[installApplicationCenter] Modifying /opt/IBM/WebSphere/Liberty/usr/servers/simpleServer/server.xml
[installApplicationCenter] Deleting /opt/IBM/WebSphere/Liberty/usr/servers/simpleServer/server.xml.bak2
BUILD FAILED
/opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples/configure-appcenter-liberty-mysql-edited.xml:74: An error occured while reading file /opt/IBM/WebSphere/Liberty/usr/servers/simpleServer/server.xml. Error: null.
at com.ibm.worklight.config.ant.appserver.AppCenterAppServerTask.wasLibertyAugmentConfigFiles(AppCenterAppServerTask.java:654)
at com.ibm.worklight.config.ant.appserver.AppServerTask.configureAppServer(AppServerTask.java:4423)
at com.ibm.worklight.config.ant.appserver.AppServerTask.installItems(AppServerTask.java:4165)
at com.ibm.worklight.config.ant.appserver.AppCenterAppServerTask.installItems(AppCenterAppServerTask.java:1143)
at com.ibm.worklight.config.ant.appserver.AppServerTask.processItems(AppServerTask.java:4114)
at com.ibm.worklight.config.ant.appserver.AppCenterAppServerTask.buildAndProcessItems(AppCenterAppServerTask.java:1088)
at com.ibm.worklight.config.ant.appserver.AppServerTask.setupBuildAndProcessItems(AppServerTask.java:3064)
at com.ibm.worklight.config.ant.appserver.AppServerTask.doExecute(AppServerTask.java:307)
at com.ibm.worklight.config.ant.appserver.InstallApplicationCenterTask.execute(InstallApplicationCenterTask.java:28)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
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.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.NullPointerException
at com.ibm.worklight.config.helper.appserver.WASLibertyAugmentServerXML.addAppCenterApplicationAndDataSourceElements(WASLibertyAugmentServerXML.java:1921)
at com.ibm.worklight.config.helper.appserver.WASLibertyAugmentServerXML.mainInstallApplicationCenter(WASLibertyAugmentServerXML.java:143)
at com.ibm.worklight.config.ant.appserver.AppCenterAppServerTask.wasLibertyAugmentConfigFiles(AppCenterAppServerTask.java:642)
... 25 more
Total time: 7 seconds
Just based on the name of the Ant file you're using, and the pathnames displayed in in the message output you included, it looks like you started from the wrong sample Ant file - in other words, it appears that you are using Liberty Profile as your application server, but you started from the sample Ant file for use with WebSphere Application Server.
Assuming that is in fact the case, you should start with the sample configuration file "configure-appcenter-liberty-mysql.xml" instead.
Also, just as a hint - it appears that even with the file you are using, you modified the sample Ant file provided with MobileFirst Platform Foundation 7.1 "in place" and wrote it back to it's original filename and used it? As mentioned in the documentation link you have in your question, it's actually recommended to make a copy of this file and work with the copy, rather than modifying the one we provide - that way, you'll always have the unmodified samples we provide, in case you want to refer to them, or use them as templates for a different server and/or different configuration.
I think you use Liberty Profile 8.5.5.9. There were some changes concerning the password decoding mechanism in this version that is no more compatible with MobileFirst.
Either you ask the IBM support for the APAR http://www-01.ibm.com/support/docview.wss?crawler=1&uid=swg1PI61386, either you use Liberty 8.5.5.8.

The rule 'OCLint:ivar assignment outside accessors or init' does not exist

I am trying to integrate SonarQube to generate report on my iOS project,
I am using Objective-C Sonar plugin
When i run ./run-sonar.sh
OCLint generates a compile_commands.json file in my root directory.
and after that getting following error
11:24:39.782 INFO - Processing OCLint report /Users/.......app/./sonar-reports/oclint.xml
11:24:39.899 ERROR - Reporting 1073 violations.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 16.240s
Final Memory: 6M/86M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: The rule 'OCLint:ivar assignment outside accessors or init' does not exist.
Can any one help me on this issue?
Thanks
AMR
Thnaks
I had a similar error. My sonar server had two objective-c code analyser plugin. The Sonar Plugin for Objective C (free) and SonarSource Objective-C plugin (commercial)
When I removed (uninstalled) one of the plugin from sonar server the error stopped to occur
I had a similar error too with the last version of this plugin which is a fork of the one you used.
I downgrade my OCLint version from 0.11 to 0.10.1 and everything work perfectly.
It seems that the OCLint rules defined in the plugin was different of the OCLint version installed on my server.
I am not sure what version of the objective-c-sonar plugin that you were using.
I solved similar issue before.
Goto ${SONAR_INSTALLATION_FOLDER}/extensions/plugins/, copy the sonar-objective-c-plugin-${version}.jar to somewhere else.
unzip the jar file, and edit below file
org/sonar/plugins/objectivec/profile-oclint.xml
Add the rule you are missing following the layout of the xml file,
may be look similar below
<rule>
<repositoryKey>OCLint</repositoryKey>
<key>ivar assignment outside accessors or init</key>
</rule>
And edit another file org/sonar/plugins/objectivec/rules-oclint.xml
<rule>
<key>ivar assignment outside accessors or init</key>
<name>ivar assignment outside accessors or init</name>
<priority>MAJOR</priority>
<description>ivar assignment outside accessors or init</description>
</rule>
And then using zip to package the files unpacked as the new jar file.
Override the original plugin jar file in ${SONAR_INSTALLATION_FOLDER}/extensions/plugins/, restart the sonar, issue could be gone.
Repeat the step for all similar issues you encountered.

Jenkins Ruby metrics plugin fail to copy .gitkeep

Jenkins Ruby metrics plugin cause error when copy .gitkeep file to log directory, because it fails to create log directory.
Error message is below.
Publishing rcov report...
ERROR: Publisher hudson.plugins.rubyMetrics.rcov.RcovPublisher aborted due to exception
Failed to copy /Users/Shared/Jenkins/Home/jobs/RailsApp/workspace/log/.gitkeep to /Users/Shared/Jenkins/Home/jobs/RailsApp/builds/2014-02-05_21-07-52/log/.gitkeep due to failed to create the parent directory for /Users/Shared/Jenkins/Home/jobs/RailsApp/builds/2014-02-05_21-07-52/log/.gitkeep
at org.apache.tools.ant.taskdefs.Copy.doFileOperations(Copy.java:914)
at org.apache.tools.ant.taskdefs.Copy.execute(Copy.java:567)
at hudson.Util.copyFile(Util.java:922)
at hudson.FilePath$38$1.visit(FilePath.java:1937)
at hudson.util.DirScanner.scanSingle(DirScanner.java:49)
at hudson.util.DirScanner$Glob.scan(DirScanner.java:131)
at hudson.FilePath$38.invoke(FilePath.java:1932)
at hudson.FilePath$38.invoke(FilePath.java:1925)
at hudson.FilePath.act(FilePath.java:914)
at hudson.FilePath.act(FilePath.java:887)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1925)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1911)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1894)
at hudson.plugins.rubyMetrics.Utils.moveReportsToBuildRootDir(Utils.java:28)
at hudson.plugins.rubyMetrics.Utils.moveReportsToBuildRootDir(Utils.java:12)
at hudson.plugins.rubyMetrics.HtmlPublisher.prepareMetricsReportBeforeParse(HtmlPublisher.java:30)
at hudson.plugins.rubyMetrics.rcov.RcovPublisher.perform(RcovPublisher.java:50)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:784)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:756)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:705)
at hudson.model.Run.execute(Run.java:1695)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:231)
Caused by: java.io.IOException: failed to create the parent directory for /Users/Shared/Jenkins/Home/jobs/RailsApp/builds/2014-02-05_21-07-52/log/.gitkeep
at org.apache.tools.ant.util.ResourceUtils.copyResource(ResourceUtils.java:512)
at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:559)
at org.apache.tools.ant.taskdefs.Copy.doFileOperations(Copy.java:899)
... 25 more
Jenkins didn't create log 'directory' but log 'file'. Jenkins have permission to read/write of the directory of course. Any ideas? Thanks in advance.
I spend a lot of time to fix this issue.
In fact, when you activate the Ruby metrics plugin, you have to provide a directory. If you don't, the default folder is log, and it is the cause of your error.
So, go to your project configuration and in the Publish Rcov Report section, you just fill the directory.
Enjoy :)

Resources