cloud-opensource-java
cloud-opensource-java copied to clipboard
NullPointerException when annotating com.google.cloud:spring-cloud-gcp-dependencies
While checking takari-local-repository, I found NullPointerException (memo). Even with the latest 1.5.4 Linkage Checker enforcer rule, the problem (https://github.com/GoogleCloudPlatform/cloud-opensource-java/issues/1609) recurs
suztomo@suztomo:~/spring-cloud-gcp$ mvn --activate-profiles linkage-check\
--batch-mode --show-version\
--threads 1.5C --define skipTests=true\
--define maven.javadoc.skip=true --errors install
...
suztomo@suztomo:~/spring-cloud-gcp$ git remote -v
origin https://github.com/GoogleCloudPlatform/spring-cloud-gcp.git (fetch)
origin https://github.com/GoogleCloudPlatform/spring-cloud-gcp.git (push)
suztomo@suztomo:~/spring-cloud-gcp$ git diff
diff --git a/spring-cloud-gcp-dependencies/pom.xml b/spring-cloud-gcp-dependencies/pom.xml
index b0752ca0..2050a6d8 100644
--- a/spring-cloud-gcp-dependencies/pom.xml
+++ b/spring-cloud-gcp-dependencies/pom.xml
@@ -370,7 +370,7 @@
<dependency>
<groupId>com.google.cloud.tools</groupId>
<artifactId>linkage-checker-enforcer-rules</artifactId>
- <version>1.5.3</version>
+ <version>1.5.4</version>
</dependency>
</dependencies>
<executions>
[INFO] Spring Cloud GCP Dependencies ...................... FAILURE [03:58 min]
[INFO] Spring Cloud GCP Documentation ..................... SUCCESS [ 5.141 s]
[INFO] Spring Cloud GCP Code Samples ...................... SUCCESS [ 6.414 s]
[INFO] Spring Cloud GCP Code Sample - Runtime Configuration SUCCESS [ 0.863 s]
[INFO] Spring Cloud GCP Code Sample - Trace ............... SUCCESS [ 1.134 s]
[INFO] Spring Cloud GCP Code Sample - Logging ............. SUCCESS [ 5.685 s]
[INFO] Spring Cloud GCP Code Sample - MySQL ............... SUCCESS [ 0.901 s]
[INFO] Spring Cloud GCP Code Sample - Spring Integration Pub/Sub Channel Adapters SUCCESS [ 1.726 s]
[INFO] Spring Cloud GCP Code Sample - Spring Integration Pub/Sub Sender SUCCESS [ 6.948 s]
[INFO] Spring Cloud GCP Code Sample - Spring Integration Pub/Sub Receiver SUCCESS [ 3.521 s]
[INFO] Spring Cloud GCP Code Sample - Spring Integration Pub/Sub Polling Receiver SUCCESS [ 0.939 s]
[INFO] Spring Cloud GCP Code Sample - Spring Integration Pub/Sub Integration Test SUCCESS [ 1.256 s]
[INFO] Spring Cloud GCP Code Sample - Storage ............. SUCCESS [ 4.935 s]
[INFO] Spring Cloud GCP Code Sample - Spanner ............. SUCCESS [ 6.570 s]
[INFO] Spring Cloud GCP Code Sample - Datastore ........... SUCCESS [ 1.401 s]
[INFO] Spring Cloud GCP Code Sample - Datastore Bookshelf . SUCCESS [ 1.170 s]
[INFO] Spring Cloud GCP Code Sample - Pub/Sub ............. SUCCESS [ 5.817 s]
[INFO] Spring Cloud GCP Code Sample - Spring Data JPA ..... SUCCESS [ 5.201 s]
[INFO] Spring Cloud GCP Code Sample - Vision API .......... SUCCESS [ 1.230 s]
[INFO] Spring Cloud GCP Code Sample - Spring Integration Storage SUCCESS [ 5.742 s]
[INFO] Spring Cloud GCP Code Sample - Pub/Sub Stream ...... SUCCESS [ 2.143 s]
[INFO] Spring Cloud GCP Code Sample - Pub/Sub Bus Configuration Management SUCCESS [ 1.725 s]
[INFO] Spring Cloud GCP Code Sample - Pub/Sub Bus (Client) SUCCESS [ 1.453 s]
[INFO] Spring Cloud GCP Code Sample - Spring Cloud Config with Pub/Sub Bus (Local Configuration) SUCCESS [ 1.453 s]
[INFO] Spring Cloud GCP Code Sample - Spring Cloud Config with Pub/Sub Bus (GitHub Configuration) SUCCESS [ 1.452 s]
[INFO] Spring Cloud GCP Code Sample - Spring Cloud Config with Pub/Sub Bus Integration Test SUCCESS [ 1.620 s]
[INFO] Spring Cloud GCP Code Sample - Pub/Sub Stream Binder Polling SUCCESS [ 2.143 s]
[INFO] Spring Cloud GCP Code Sample - Pub/Sub Reactive .... SUCCESS [ 6.643 s]
[INFO] Spring Cloud GCP Code Sample - Spring Integration Pub/Sub JSON Payloads SUCCESS [ 6.803 s]
[INFO] Spring Cloud GCP Code Sample - IAP ................. SUCCESS [ 0.873 s]
[INFO] Spring Cloud GCP Code Sample - Postgres ............ SUCCESS [ 6.156 s]
[INFO] Spring Cloud GCP Code Sample - Vision OCR .......... SUCCESS [ 5.332 s]
[INFO] Spring Cloud GCP Code Sample - Firestore ........... SUCCESS [ 0.968 s]
[INFO] Spring Cloud GCP Code Sample - Multi-Spring-Data-Module SUCCESS [ 1.103 s]
[INFO] Spring Cloud GCP Code Sample - Spring Data Firestore SUCCESS [ 6.507 s]
[INFO] Spring Cloud GCP Code Sample - BigQuery ............ SUCCESS [ 6.511 s]
[INFO] Spring Cloud GCP Code Sample - Pub/Sub Stream Binder (Functional style) SUCCESS [ 1.713 s]
[INFO] Spring Cloud GCP Code Sample - Pub/Sub Stream Binder Source SUCCESS [ 2.191 s]
[INFO] Spring Cloud GCP Code Sample - Pub/Sub Stream Binder Sink SUCCESS [ 2.191 s]
[INFO] Spring Cloud GCP Code Sample - Pub/Sub Stream Binder Integration Test SUCCESS [ 1.465 s]
[INFO] Spring Cloud GCP Code Sample - Firebase Security ... SUCCESS [ 5.542 s]
[INFO] Spring Cloud GCP Code Sample - Secret Manager ...... SUCCESS [ 1.358 s]
[INFO] Spring Cloud GCP Code Samples - Kotlin ............. SUCCESS [ 1.732 s]
[INFO] Spring Cloud GCP Code Sample - Kotlin App Sample ... SUCCESS [ 14.329 s]
[INFO] Spring Cloud GCP Code Sample - Metrics ............. SUCCESS [ 0.934 s]
[INFO] Spring Cloud GCP Code Sample - KMS ................. SUCCESS [ 1.068 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:00 min (Wall Clock)
[INFO] Finished at: 2020-12-29T22:06:59Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce (enforce-linkage-checker) on project spring-cloud-gcp-dependencies: Execution enforce-linkage-checker of goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce (enforce-linkage-checker) on project spring-cloud-gcp-dependencies: Execution enforce-linkage-checker of goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce failed.
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.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:190)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:186)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution enforce-linkage-checker of goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
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.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:190)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:186)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)
Caused by: java.lang.NullPointerException
at com.google.cloud.tools.opensource.dependencies.DependencyGraph.levelOrder (DependencyGraph.java:259)
at com.google.cloud.tools.opensource.dependencies.DependencyGraph.from (DependencyGraph.java:244)
at com.google.cloud.tools.opensource.dependencies.DependencyGraphBuilder.buildDependencyGraph (DependencyGraphBuilder.java:209)
at com.google.cloud.tools.opensource.dependencies.DependencyGraphBuilder.buildMavenDependencyGraph (DependencyGraphBuilder.java:198)
at com.google.cloud.tools.opensource.classpath.ClassPathBuilder.resolveWithMaven (ClassPathBuilder.java:80)
at com.google.cloud.tools.opensource.classpath.LinkageProblemCauseAnnotator.annotate (LinkageProblemCauseAnnotator.java:59)
at com.google.cloud.tools.dependencies.enforcer.LinkageCheckerRule.execute (LinkageCheckerRule.java:223)
at org.apache.maven.plugins.enforcer.EnforceMojo.execute (EnforceMojo.java:205)
...
As per the stacktrace Linkage Checker was trying to annotate linkage errors (LinkageProblemCauseAnnotator.annotate
).
Note that this happens without using takari local repository extension.
But the spring-cloud-gcp repository's daily job succeeded yesterday (link)
[INFO] No reachable error found
I cannot reproduce the error today. Spring's repository seems unhealthy "Connect to repo.spring.io:443 timed out".
clode this one? @suztomo
Also hit this, tried to gather some info
levelOrder is called with a DependencyGraph with root = null
DependencyGraphBuilder.buildDependencyGraph hits the DependencyResolutionException and DependencyGraph.from(ex.getResult.getRoot()) => getRoot() returns null
For me because of org.eclipse.aether.collection.DependencyCollectionException: Failed to read artifact descriptor for ch.qos.logback:logback-access:jar:1.3.0-alpha4
which was because Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact ch.qos.logback:logback-access:pom:1.3.0-alpha4 from/to OUR_NEXUS): status code: 401, reason phrase: Unauthorized (401)
This artifact is in my local (fs) repository, when i delete it, mvn has no problem download it again from OUR_NEXUS
EnhancedLocalRepositoryManager.find() succeeds to find it multiple times times with request.repositories having OUR_NEXUS as url with id "nexus" & auth configured, after a few of those it does a lookup with "id=OUR_NEXUS" instead of "nexus" and no auth configured and then fails. My settings.xml is configured like described here https://guides.sonatype.com/repo3/quick-start-guides/proxying-maven-and-npm/
This Remote repository is created by RepositoryUtility.mavenRepositoryFromUrl()
LinkageCheckerRule.java does ImmutableList<String> repositoryUrls = project.getRemoteProjectRepositories().stream().map(RemoteRepository::getUrl).collect(toImmutableList());
and drops the configured auth (which is present on project.getRemoteProjectRepositories())
@selckin Thank you for the diagnosis. Am I right that I read that you encountered the NullPointerException when you used the Linkage Checker Maven enforcer rule with an authenticating repository?
@suztomo yes, so I suspect the original issue here was a sporadic network error that cause the same type of exception, and hence not reproducible, and a 2nd issue is with the classic setup of mirroring central over nexus that requires auth, it drops the auth info and creates its own repo class. i'm not sure if this is something you want to support, but i'd really love to have a general plugin with these capabilities
Thank you for clarification! I'm afraid that we do not have a plan to support an authenticated Maven repository as of now. If we switch the direction, then I'll update this thread.