-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail with NullPointerException when try to operate gitlab. NOTICE: npe may be cause by many situation, please find yours^_^ #168
Comments
Hi, |
Hi, |
Do you have the same problem with version 3.0.1? |
I tried version 3.0.1, exactly the same. If just use sonar to scan my code, it is good. |
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. Software versions:
DetailsI do not have a proxy related line as the reporter has: Furthermore, It looks like in GitLab's log that the plugin is able to do a login: {"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] |
@alex1989hu Have you full log please ? |
@gabrie-allaigre I think not, which kind of proxy exactly you mean? |
@wangmoApfel In debug.log line 1492 |
@wangmoApfel do you test with current |
@gabrie-allaigre Sorry about proxy, I'm not quite familiar with that party. |
@gabrie-allaigre |
@wangmoApfel Ok Thanks, |
@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 |
@gabrie-allaigre Thank you very much! Finally, the rc3 works. And it works without Thanks again. @alex1989hu you should try 4.0.0-rc3, it solved my NPE. |
@wangmoApfel Great |
@gabrie-allaigre |
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? Scenario # 1
Expected: the plugin shall add new defects as inline comment for each commit. Scenario # 2
Expected: the plugin shall add new defects as inline comment for each commit. ExtraDoes 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. |
Hi, I have exactly the same problem... My env :
The package 4.0.0-rc3 is unavailable to download. Is it possible to put it back online ? |
Hi, |
I have The same problem with this parameter... My command line : sonnar-scanner -Dsonar.host.url=http://..... |
Have you a full log please ? |
Here it is... I anonymized some logs |
I had the same problem and It was because of permission issues 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. |
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:
I call sonar-scanner directly from within my docker container with the following command:
My
The properties Our GitLab server is only accessible over SSL. So the solution was to set |
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 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 @gabrie-allaigre this is my full log thanks |
Hi, Same issue here, our gitlab is in http (not https)
|
Same issue , but i set -Dsonar.gitlab.api_version=v3 , it works well |
Same issue. Here is my code : What can I do ? |
sonar.gitlab.url use real?test? |
Please check GitLab user token |
running with this script:
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:
- test
script:
- mvn test
- cat target/site/jacoco/index.html
coverage: '/Total.*?([0-9]{1,3})%/'
sonar_preview:
stage: test
script:
- mvn --batch-mode verify sonar:sonar -Dsonar.host.url=http://nc110:19000 -Dsonar.login=33171bc93106f8cda58182f9fb8c55b343969501 -Dsonar.analysis.mode=preview -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.gitlab.project_id=$CI_PROJECT_ID -X
except:
- master
- tags
tags:
- test
`
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!
The text was updated successfully, but these errors were encountered: