Open wangmoApfel opened 6 years ago
Hi, Get log with debug mode mvn -d Thanks
Hi, I already used debug mode with -X as above. What else should I provide for this issue? Thanks
Do you have the same problem with version 3.0.1? Do you have the problem without the plugin sonar-gitlab-plugin?
I tried version 3.0.1, exactly the same. Version <= 3.0.0 will complain gitlab api 503.
If just use sonar to scan my code, it is good. This error happens when sonar try to connect gitlab, I think.
Have you full log with -X ?
Here is my full log. I removed some sensitive words. Thank you.
Do you use a proxy ?
@gabrie-allaigre, @wangmoApfel: I also have this exception. This is the first time I tried to use the plugin itself. It is also important that I have been already using the auth plugin without any problem.
I do not have a proxy related line as the reporter has:
[INFO] 10:45:51.096 A proxy has been configured - HTTP @ 10.168.17.163:3128
Furthermore, It looks like in GitLab's log that the plugin is able to do a login: => /var/log/gitlab/gitlab-rails/api_json.log <==
{"time":"2018-09-02T10:48:37.327Z","severity":"INFO","duration":239.76,"db":14.86,"view":224.89999999999998,"status":200,"method":"GET","path":"/api/v4/projects","params":{"membership":"false","order_by":"created_at","owned":"false","page":"5","per_page":"20","repository_checksum_failed":"false","simple":"false","sort":"desc","starred":"false","statistics":"false","wiki_checksum_failed":"false","with_custom_attributes":"false","with_issues_enabled":"false","with_merge_requests_enabled":"false"},"host":"gitlab.whatever.com","ip":"ip-whatever","ua":"Java/1.8.0_152","user_id":118,"username":"sonarqubeaw","queue_duration":4.96}
... but in Maven I also get an exception with the similar stracktrace
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar (default-cli) on project whatever-project: null: MojoExecutionException: NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar (default-cli) on project whatever-project: null
@alex1989hu Have you full log please ?
@gabrie-allaigre I think not, which kind of proxy exactly you mean?
@wangmoApfel In debug.log line 1492 [INFO] 10:45:51.096 A proxy has been configured - HTTP @ 10.168.17.163:3128
@wangmoApfel do you test with current sonar-gitlab-plugin-4.0.0-SNAPSHOT.zip build and get full log please. Warning if a zip, you must unzip.
@gabrie-allaigre Sorry about proxy, I'm not quite familiar with that party. I will try this snapshot ASAP, thank you very much.
@gabrie-allaigre
The debug log looks same with before. Does the proxy configured matter?
@wangmoApfel Ok Thanks,
Problems is gitlab project is null (no empty, just null), it's strange.
Maybe problems with proxy.
Proxy is auto, it's a system value http.proxyHost
SonarQube use a proxy ?
@wangmoApfel Test with new release https://github.com/gabrie-allaigre/sonar-gitlab-plugin/releases/download/4.0.0-rc3/sonar-gitlab-plugin-4.0.0-rc3.jar
And add in command line -Dsonar.gitlab.disable_proxy=true
@gabrie-allaigre Thank you very much! Finally, the rc3 works. And it works without -Dsonar.gitlab.disable_proxy=true
.
Thanks again.
@alex1989hu you should try 4.0.0-rc3, it solved my NPE.
@wangmoApfel Great
@gabrie-allaigre
hi gabrie, is inline comments not supported now? I can only get global comment.
inline comments work. New Issue is in current commit ?
@gabrie-allaigre: installed 4.0.0-rc3, NPE disappeared. Nice job 👍Is the following a normal behaviour?
-Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA
Expected: the plugin shall add new defects as inline comment for each commit. Actual: the plugin published inline comments for the 1st pipeline, but did not add any comment for new issues introduced in 2nd pipeline. Checked that the issue has been discovered, printed in job's log
-Dsonar.gitlab.commit_sha=$(git log --pretty=format:%H origin/master..$CI_COMMIT_SHA | tr '\n' ',')
Expected: the plugin shall add new defects as inline comment for each commit. Actual: the plugin published inline comments as global comments for the 1st pipeline, but did not add any comment for new issues introduced in 2nd pipeline. Checked that the issue has been discovered, printed in job's log.
Does it matter that my pipeline has several separate jobs on different source code? I mean ComponentA has a sonar scan in build phase 1, and CompenentB has a sonar scan in build phase2. Both scenarios above were executed in this setup.
@gabrie-allaigre No, sorry, I misused, inline comment works.
If it is possible creating a discussion with attribute resolvable
?
I searched gitlab api doc, https://docs.gitlab.com/ee/api/discussions.html, didn't find that parameter.
Hi,
I have exactly the same problem... My env : gitlab: GitLab Community Edition 11.2.3 sonarqube: 7.3 sonar-gitlab-plugin: 4.0.0
0:22:58.902 ERROR: Error during SonarQube Scanner execution java.lang.NullPointerException at com.talanlabs.sonar.plugins.gitlab.GitLabApiV4Wrapper.createOrUpdateSonarQubeStatus(GitLabApiV4Wrapper.java:211) at com.talanlabs.sonar.plugins.gitlab.CommitFacade.createOrUpdateSonarQubeStatus(CommitFacade.java:128) at com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob.execute(CommitPublishPostJob.java:112) at org.sonar.scanner.postjob.PostJobWrapper.execute(PostJobWrapper.java:46) at org.sonar.scanner.phases.PostJobsExecutor.execute(PostJobsExecutor.java:51) at org.sonar.scanner.phases.PostJobsExecutor.execute(PostJobsExecutor.java:42) at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:80) at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:166) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:300) at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:295) at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:269) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48) at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:82) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:131) at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116) at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71) at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46) 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.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) at com.sun.proxy.$Proxy0.execute(Unknown Source) at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171) at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128) at org.sonarsource.scanner.cli.Main.execute(Main.java:111) at org.sonarsource.scanner.cli.Main.execute(Main.java:75) at org.sonarsource.scanner.cli.Main.main(Main.java:61)
The package 4.0.0-rc3 is unavailable to download. Is it possible to put it back online ?
Hi,
4.0.0 is a final version.
Add -Dsonar.gitlab.disable_proxy=true
I have The same problem with this parameter... My command line :
sonnar-scanner -Dsonar.host.url=http://..... -Dsonar.projectKey=.... -Dsonar.sources=src -Dsonar.login=mytoken -Dsonar.analysis.mode=preview -Dsonar.issuesReport.html.enable=true -Dsonar.gitlab.project_id=55 -Dsonar.gitlab.commit_sha=.... -Dsonar.gitlab.ref_name=.... -Dsonar.gitlab.disable_proxy=true
Have you a full log please ?
Here it is... I anonymized some logs
Here it is... I anonymized some logs
I had the same problem and It was because of permission issues
check your API log while your command is running
/var/log/gitlab/gitlab-rails/api_json.log
I guess the problem doesn't expect 401 error and because of that some variable stays null
@ehsanmohammadi: I'd like to share my experience. Is the GitLab project set as private project? I also got NPE when Sonar did not have the permission to read the repository. It is also written in README.md, but I did not notice.
@ehsanmohammadi: I'd like to share my experience. Is the GitLab project set as private project? I also got NPE when Sonar did not have the permission to read the repository. It is also written in README.md, but I did not notice.
Yes, It was a private repo on my self-hosted Gitlab server. but based on the README.md we will get IllegalStateException not NPE.
I had the same issue with the NullPointerException:
java.lang.NullPointerException
at com.talanlabs.sonar.plugins.gitlab.GitLabApiV4Wrapper.createOrUpdateSonarQubeStatus(GitLabApiV4Wrapper.java:211)
at com.talanlabs.sonar.plugins.gitlab.CommitFacade.createOrUpdateSonarQubeStatus(CommitFacade.java:128)
at com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob.execute(CommitPublishPostJob.java:112)
at org.sonar.scanner.postjob.PostJobWrapper.execute(PostJobWrapper.java:46)
at org.sonar.scanner.phases.PostJobsExecutor.execute(PostJobsExecutor.java:51)
at org.sonar.scanner.phases.PostJobsExecutor.execute(PostJobsExecutor.java:42)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:80)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:166)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:300)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:295)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:269)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:82)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:131)
at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
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.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
I call sonar-scanner directly from within my docker container with the following command:
sonar-scanner -X -Dsonar.login=$SONAR_LOGIN -Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=$CI_PROJECT_ID -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.gitlab.json_mode=CODECLIMATE -Dsonar.gitlab.failure_notification_mode=commit-status
My sonar-project.properties
file looks like:
sonar.projectKey=may-app
sonar.projectName=My App
sonar.host.url=http://sonarqube.my.domain
sonar.gitlab.api_version=v4
sonar.exclusions=**/node_modules/**,**/coverage/**,**/target/**,**/flow-typed/**
sonar.sources=.
sonar.sourceEncoding=UTF-8
The properties sonar.gitlab.url
and sonar.gitlab.user_token
are defined under SonarQube/Administration/Configuration/GitLab
Our GitLab server is only accessible over SSL. So the solution was to set sonar.gitlab.ignore_certificate
to true.
Sorry for this late response... I have not had time to test this yet, i'll try it as soon as possible and i'll keep you informed.
Thanks
It works for me with the sonar.gitlab.ignore_certificate
flag set to true.
Thank you
Just ran into the same NPE because of an invalid Gitlab access token. It would be great to not die with a NPE but a corresponding AuthenticationException.
i have the same issue [INFO] 09:36:37.359 ANALYSIS SUCCESSFUL [DEBUG] 09:36:37.447 Post-jobs : GitLab Commit Issue Publisher [INFO] 09:36:37.447 Executing post-job 'GitLab Commit Issue Publisher' [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:27 min [INFO] Finished at: 2018-12-26T09:37:17Z [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.5.0.1254:sonar (default-cli) on project microservice-admin: null: MojoExecutionException: NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.5.0.1254:sonar (default-cli) on project microservice-admin: null at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
@gabrie-allaigre this is my full log thanks out.log
Hi,
Same issue here, our gitlab is in http (not https)
/opt/sonar-scanner/bin/sonar-scanner -Dsonar.login=xxxxxxxxxxxxxxxxxxxx -Dsonar.analysis.mode=preview -Dsonar.gitlab.ignore_certificate=true -Dsonar.gitlab.disable_proxy=true -Dsonar.gitlab.commit_sha=$CI_COMMIT_REF -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.gitlab.project_id=${CI_PROJECT_NAMESPACE}/$CI_PROJECT_ID -Dsonar.projectName=${CI_PROJECT_NAMESPACE}_${CI_PROJECT_NAME} -Dsonar.projectKey=${CI_PROJECT_NAMESPACE}_${CI_PROJECT_NAME} -Dsonar.projectVersion=${CI_COMMIT_TAG} -Dsonar.branch.name=${CI_COMMIT_REF_NAME} -Dsonar.branch.target=dev -Dsonar.sources=${CI_PROJECT_DIR}/${CI_PROJECT_NAME//-/_} -Dsonar.tests=${CI_PROJECT_DIR}/tests -Dsonar.python.pylint.reportPath=${CI_PROJECT_DIR}/pylint-reports/pylint-report.txt -X
10:24:18.956 INFO: Scanner configuration file: /opt/sonar-scanner-3.2.0.1227-linux/conf/sonar-scanner.properties
10:24:18.960 INFO: Project root configuration file: NONE
10:24:18.979 INFO: SonarQube Scanner 3.2.0.1227
10:24:18.980 INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
10:24:18.980 INFO: Linux 3.10.0-862.14.4.el7.x86_64 amd64
10:24:19.099 DEBUG: keyStore is :
10:24:19.099 DEBUG: keyStore type is : jks
10:24:19.099 DEBUG: keyStore provider is :
10:24:19.099 DEBUG: init keystore
10:24:19.099 DEBUG: init keymanager of type SunX509
10:24:19.168 DEBUG: Create: /home/gitlab-runner/.sonar/cache
10:24:19.169 INFO: User cache: /home/gitlab-runner/.sonar/cache
10:24:19.169 DEBUG: Create: /home/gitlab-runner/.sonar/cache/_tmp
10:24:19.171 DEBUG: Extract sonar-scanner-api-batch in temp...
10:24:19.175 DEBUG: Get bootstrap index...
10:24:19.175 DEBUG: Download: http://localhost:9000/batch/index
10:24:19.215 DEBUG: Get bootstrap completed
10:24:19.221 DEBUG: Create isolated classloader...
10:24:19.228 DEBUG: Start temp cleaning...
10:24:19.232 DEBUG: Temp cleaning done
10:24:19.232 DEBUG: Execution getVersion
10:24:19.234 INFO: SonarQube server 7.5.0
10:24:19.235 INFO: Default locale: "fr_FR", source code encoding: "UTF-8" (analysis is platform dependent)
10:24:19.235 DEBUG: Work directory: /home/gitlab-runner/builds/f7736604/0/xxxxxxx/.scannerwork
10:24:19.236 DEBUG: Execution execute
10:24:19.374 INFO: Issues mode
10:24:19.374 WARN: The use of the issues mode (sonar.analysis.mode=issues) is deprecated. This mode will be dropped in the future.
10:24:19.486 INFO: Load global settings
10:24:19.527 DEBUG: GET 200 http://localhost:9000/api/settings/values.protobuf | time=34ms
10:24:19.550 INFO: Load global settings (done) | time=65ms
10:24:19.557 INFO: Server id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
10:24:19.566 INFO: User cache: /home/gitlab-runner/.sonar/cache
10:24:19.574 INFO: Exclude plugins: devcockpit, ldap, authgithub, authbitbucket, pdfreport, authaad, googleanalytics, governance
10:24:19.759 INFO: Load/download plugins
10:24:19.759 INFO: Load plugins index
10:24:19.766 DEBUG: GET 200 http://localhost:9000/api/plugins/installed | time=7ms
10:24:19.797 INFO: Load plugins index (done) | time=38ms
10:24:19.875 INFO: Load/download plugins (done) | time=116ms
10:24:20.035 DEBUG: Plugins:
10:24:20.036 DEBUG: * SonarCSS 1.0.3.724 (cssfamily)
10:24:20.036 DEBUG: * Svn 1.9.0.1295 (scmsvn)
10:24:20.036 DEBUG: * SonarPLSQL 3.3.0.2273 (plsql)
10:24:20.036 DEBUG: * SonarScala 1.4.0.155 (sonarscala)
10:24:20.036 DEBUG: * SonarC# 7.9.1.7622 (csharp)
10:24:20.036 DEBUG: * Vulnerability Analysis 7.5.0.2620 (security)
10:24:20.036 DEBUG: * SonarJava 5.9.2.16552 (java)
10:24:20.036 DEBUG: * SonarFlex 2.4.0.1222 (flex)
10:24:20.036 DEBUG: * SonarXML 1.5.1.1452 (xml)
10:24:20.036 DEBUG: * SonarTS 1.8.0.3332 (typescript)
10:24:20.036 DEBUG: * SonarVB 7.9.1.7622 (vbnet)
10:24:20.036 DEBUG: * SonarSwift 4.0.0.2853 (swift)
10:24:20.037 DEBUG: * YAML Analyzer 1.3.0 (yaml)
10:24:20.037 DEBUG: * SonarCFamily 6.0.0.10816 (cpp)
10:24:20.037 DEBUG: * SonarPython 1.10.0.2131 (python)
10:24:20.037 DEBUG: * JaCoCo 1.0.1.143 (jacoco)
10:24:20.037 DEBUG: * SonarGo 1.1.0.1612 (go)
10:24:20.037 DEBUG: * SonarKotlin 1.4.0.155 (kotlin)
10:24:20.037 DEBUG: * SonarTSQL 1.3.1.3067 (tsql)
10:24:20.037 DEBUG: * SonarJS 5.0.0.6962 (javascript)
10:24:20.037 DEBUG: * SonarRuby 1.4.0.155 (ruby)
10:24:20.037 DEBUG: * Vulnerability Rules for C# 7.5.0.2620 (securitycsharpfrontend)
10:24:20.037 DEBUG: * Vulnerability Rules for Java 7.5.0.2620 (securityjavafrontend)
10:24:20.038 DEBUG: * License for SonarLint 7.5 (license)
10:24:20.038 DEBUG: * Git 1.6.0.1349 (scmgit)
10:24:20.038 DEBUG: * SonarPHP 2.15.0.4060 (php)
10:24:20.038 DEBUG: * GitLab 4.0.0 (gitlab)
10:24:20.038 DEBUG: * SonarABAP 3.7.0.1603 (abap)
10:24:20.054 INFO: Loaded core extensions: branch-scanner
10:24:20.066 DEBUG: Installed core extension: branch-scanner
10:24:20.456 DEBUG: Installed core extension: branch-scanner
10:24:20.531 INFO: Scanning only changed files
10:24:20.533 INFO: Process project properties
10:24:20.540 DEBUG: Process project properties (done) | time=7ms
10:24:20.540 INFO: Execute project builders
10:24:20.543 INFO: Execute project builders (done) | time=3ms
10:24:20.557 INFO: Load project branches
(...)
10:24:29.113 ERROR: Error during SonarQube Scanner execution
java.lang.NullPointerException
at com.talanlabs.sonar.plugins.gitlab.GitLabApiV4Wrapper.createOrUpdateSonarQubeStatus(GitLabApiV4Wrapper.java:211)
at com.talanlabs.sonar.plugins.gitlab.CommitFacade.createOrUpdateSonarQubeStatus(CommitFacade.java:128)
at com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob.execute(CommitPublishPostJob.java:112)
at org.sonar.scanner.postjob.PostJobWrapper.execute(PostJobWrapper.java:46)
at org.sonar.scanner.phases.PostJobsExecutor.execute(PostJobsExecutor.java:51)
at org.sonar.scanner.phases.PostJobsExecutor.execute(PostJobsExecutor.java:42)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:80)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:164)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:319)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:314)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:288)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:82)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:131)
at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
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.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR: Job failed: exit status 1
Same issue , but i set -Dsonar.gitlab.api_version=v3 , it works well
Same issue.
Here is my code :
mvn -X --batch-mode verify sonar:sonar -Dsonar.host.url=X -Dsonar.login=X -Dsonar.analysis.mode=preview -Dsonar.gitlab.url=https://gitlab.com/namespace/projectname -Dsonar.gitlab.project_id=$CI_PROJECT_ID -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.gitlab.ignore_certificate=true -Dsonar.gitlab.disable_proxy=true
What can I do ?
Same issue.
Here is my code :
mvn -X --batch-mode verify sonar:sonar -Dsonar.host.url=X -Dsonar.login=X -Dsonar.analysis.mode=preview -Dsonar.gitlab.url=https://gitlab.com/namespace/projectname -Dsonar.gitlab.project_id=$CI_PROJECT_ID -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.gitlab.ignore_certificate=true -Dsonar.gitlab.disable_proxy=true
What can I do ?
sonar.gitlab.url use real?test?
Same issue. But my situation is because the gitlab service address changes, so I can correct the gitlab service address. Or set -Dsonar.gitlab.url=Real gitlab service
I have exactly the same issue. However, it's my own problem as I didn't add the user sonarqube to my gitlab project as a maintainer.
But, it's better to have a more clear message other than NullPointerException.
I spend half a day on this issue and finally got some useful log messages from gitlab\logs\gitlab-rails\api_json.log like below: It told me that when sonarqube try to access to my project via the gitlab v4 api is 404.
I have exactly the same issue. However, it's my own problem as I didn't add the user sonarqube to my gitlab project as a maintainer.
But, it's better to have a more clear message other than NullPointerException.
I spend half a day on this issue and finally got some useful log messages from gitlab\logs\gitlab-rails\api_json.log like below: It told me that when sonarqube try to access to my project via the gitlab v4 api is 404.
sorry, but it turns out this post collect many different situations which cause npe. you may not know the reason before you solve your problem. but, you are correct, i will comment the title, thank you
I had the same issue with the NullPointerException:
java.lang.NullPointerException at com.talanlabs.sonar.plugins.gitlab.GitLabApiV4Wrapper.createOrUpdateSonarQubeStatus(GitLabApiV4Wrapper.java:211) at com.talanlabs.sonar.plugins.gitlab.CommitFacade.createOrUpdateSonarQubeStatus(CommitFacade.java:128) at com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob.execute(CommitPublishPostJob.java:112) at org.sonar.scanner.postjob.PostJobWrapper.execute(PostJobWrapper.java:46) at org.sonar.scanner.phases.PostJobsExecutor.execute(PostJobsExecutor.java:51) at org.sonar.scanner.phases.PostJobsExecutor.execute(PostJobsExecutor.java:42) at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:80) at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:166) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:300) at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:295) at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:269) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48) at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:82) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:131) at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116) at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71) at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46) 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.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) at com.sun.proxy.$Proxy0.execute(Unknown Source) at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171) at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128) at org.sonarsource.scanner.cli.Main.execute(Main.java:111) at org.sonarsource.scanner.cli.Main.execute(Main.java:75) at org.sonarsource.scanner.cli.Main.main(Main.java:61)
I call sonar-scanner directly from within my docker container with the following command:
sonar-scanner -X -Dsonar.login=$SONAR_LOGIN -Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=$CI_PROJECT_ID -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.gitlab.json_mode=CODECLIMATE -Dsonar.gitlab.failure_notification_mode=commit-status
My
sonar-project.properties
file looks like:sonar.projectKey=may-app sonar.projectName=My App sonar.host.url=http://sonarqube.my.domain sonar.gitlab.api_version=v4 sonar.exclusions=**/node_modules/**,**/coverage/**,**/target/**,**/flow-typed/** sonar.sources=. sonar.sourceEncoding=UTF-8
The properties
sonar.gitlab.url
andsonar.gitlab.user_token
are defined under SonarQube/Administration/Configuration/GitLabOur GitLab server is only accessible over SSL. So the solution was to set
sonar.gitlab.ignore_certificate
to true.
Please check GitLab user token
running with this script: - sonar-scanner -Dsonar.qualitygate.wait=true -Dsonar.analysis.mode=publish -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.gitlab.project_id=$CI_PROJECT_ID -Dsonar.gitlab.user_token=GITLAB_USER_TOKEN -Dsonar.gitlab.ignore_certificate=true -Dsonar.gitlab.api_version=v3
and jump into this error:
ERROR: Failed to execute project builder: com.talanlabs.sonar.plugins.gitlab.CommitProjectBuilder
ERROR: Caused by: Unable to perform GitLab WS operation
ERROR: Caused by: Server returned HTTP response code: 503 for URL: https://gitlab.com/users/sign_in
Does anyone know how to fix this? Thanks.
env: gitlab: GitLab Community Edition 10.5.6 4b41d48 sonarqube: 7.2.1 (7.3 also same) sonar-gitlab-plugin: 4.0.0-rc1 (3.0.1 also same)
desc: always get following error:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.1.1168:sonar (default-cli) on project sdkdev: null: MojoExecutionException: NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.1.1168:sonar (default-cli) on project sdkdev: null
my .gitlab-ci.yml is: ` before_script:
unit_test: tags:
sonar_preview: stage: test script:
ERROR stack is this:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.1.1168:sonar (default-cli) on project sdkdev: null: MojoExecutionException: NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.1.1168:sonar (default-cli) on project sdkdev: null at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) 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:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: org.apache.maven.plugin.MojoExecutionException at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute (ScannerBootstrapper.java:67) at org.sonarsource.scanner.maven.SonarQubeMojo.execute (SonarQubeMojo.java:104) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) 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:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: java.lang.NullPointerException at com.talanlabs.sonar.plugins.gitlab.GitLabApiV4Wrapper.createOrUpdateSonarQubeStatus (GitLabApiV4Wrapper.java:211) at com.talanlabs.sonar.plugins.gitlab.CommitFacade.createOrUpdateSonarQubeStatus (CommitFacade.java:122) at com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob.execute (CommitPublishPostJob.java:112) at org.sonar.scanner.postjob.PostJobWrapper.executeOn (PostJobWrapper.java:58) at org.sonar.scanner.phases.PostJobsExecutor.execute (PostJobsExecutor.java:66) at org.sonar.scanner.phases.PostJobsExecutor.execute (PostJobsExecutor.java:55) at org.sonar.scanner.phases.AbstractPhaseExecutor.execute (AbstractPhaseExecutor.java:94) at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart (ModuleScanContainer.java:182) at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:122) at org.sonar.scanner.scan.ProjectScanContainer.scan (ProjectScanContainer.java:312) at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively (ProjectScanContainer.java:307) at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart (ProjectScanContainer.java:281) at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:122) at org.sonar.scanner.task.ScanTask.execute (ScanTask.java:48) at org.sonar.scanner.task.TaskContainer.doAfterStart (TaskContainer.java:81) at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:122) at org.sonar.scanner.bootstrap.GlobalContainer.executeTask (GlobalContainer.java:132) at org.sonar.batch.bootstrapper.Batch.doExecuteTask (Batch.java:116) at org.sonar.batch.bootstrapper.Batch.execute (Batch.java:71) at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute (BatchIsolatedLauncher.java:46) 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:497) at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke (IsolatedLauncherProxy.java:60) at com.sun.proxy.$Proxy40.execute (Unknown Source) at org.sonarsource.scanner.api.EmbeddedScanner.doExecute (EmbeddedScanner.java:171) at org.sonarsource.scanner.api.EmbeddedScanner.execute (EmbeddedScanner.java:128) at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute (ScannerBootstrapper.java:65) at org.sonarsource.scanner.maven.SonarQubeMojo.execute (SonarQubeMojo.java:104) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) 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:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) [ERROR] [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 ERROR: Job failed: exit status 1
I also tried lower version sonarqube and sonar-gitlab-plugin, that combination complains gitlab API 503, so I think that version does not match my current gitlab version.
Thank you very much!