Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-35632

NullPointerException can occur while running Repair-rebuild metadata task when GAV JAR is missing.

    Details

    • Story Points:
      2
    • Sprint:
      NXRM MadMax Sprint 46, NXRM MadMax Sprint 47
    • Notability:
      3

      Description

      Running "Repair-rebuild metadata task" with "Rebuild Checksums" option can cause NullPointerException when this task process a component version's jar file when the jar is missing.

      2022-10-06 15:39:21,640-0400 DEBUG [quartz-10-thread-20]  *SYSTEM org.sonatype.nexus.repository.maven.internal.orient.MavenFacetImpl - GET maven-hosted : com/example/test/test-maven-plugin/20.8-202010291337-f5c6bfe/test-maven-plugin-20.8-202010291337-f5c6bfe.jar
      2022-10-06 15:39:21,641-0400 ERROR [quartz-10-thread-20]  *SYSTEM org.sonatype.nexus.repository.maven.tasks.RebuildMaven2MetadataTask - Failed to run task 'Rebuilding Maven Metadata of maven-hosted' on repository 'maven-hosted'
      java.lang.NullPointerException: null
      	at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder$OrientWorker.lambda$9(OrientMetadataRebuilder.java:452)
      	at org.sonatype.nexus.repository.maven.internal.hosted.metadata.MetadataUtils.getPluginPrefix(MetadataUtils.java:78)
      	at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder$OrientWorker.collectComponentAssetInformation(OrientMetadataRebuilder.java:452)
      	at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder$OrientWorker.rebuildBaseVersion(OrientMetadataRebuilder.java:418)
      	at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder$OrientWorker.lambda$4(OrientMetadataRebuilder.java:321)
      	at org.sonatype.nexus.transaction.OperationPoint.lambda$0(OperationPoint.java:53)
      	at org.sonatype.nexus.transaction.OperationPoint.proceed(OperationPoint.java:64)
      	at org.sonatype.nexus.transaction.TransactionalWrapper.proceedWithTransaction(TransactionalWrapper.java:58)
      	at org.sonatype.nexus.transaction.Operations.proceedWithTransaction(Operations.java:232)
      	at org.sonatype.nexus.transaction.Operations.transactional(Operations.java:219)
      	at org.sonatype.nexus.transaction.Operations.run(Operations.java:175)
      	at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder$OrientWorker.rebuildMetadataInner(OrientMetadataRebuilder.java:321)
      	at org.sonatype.nexus.repository.maven.internal.hosted.metadata.AbstractMetadataRebuilder$Worker.rebuildMetadata(AbstractMetadataRebuilder.java:234)
      	at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder.rebuildInTransaction(OrientMetadataRebuilder.java:132)
      	at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder.rebuild(OrientMetadataRebuilder.java:114)
      	at org.sonatype.nexus.repository.maven.internal.orient.MavenHostedFacetImpl.rebuildMetadata(MavenHostedFacetImpl.java:118)
      	at org.sonatype.nexus.repository.maven.tasks.RebuildMaven2MetadataTask.execute(RebuildMaven2MetadataTask.java:60)
      	at org.sonatype.nexus.repository.RepositoryTaskSupport.execute(RepositoryTaskSupport.java:79)
      	.
      	.
      
      Caused by: java.lang.NullPointerException: null
      	at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder$OrientWorker.lambda$9(OrientMetadataRebuilder.java:452)
      	at org.sonatype.nexus.repository.maven.internal.hosted.metadata.MetadataUtils.getPluginPrefix(MetadataUtils.java:78)
      	at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder$OrientWorker.collectComponentAssetInformation(OrientMetadataRebuilder.java:452)
      	at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder$OrientWorker.refreshVersion(OrientMetadataRebuilder.java:469)
      	at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder$OrientWorker.lambda$6(OrientMetadataRebuilder.java:352)
      	at org.sonatype.nexus.transaction.OperationPoint.proceed(OperationPoint.java:64)
      	at org.sonatype.nexus.transaction.Operations.transactional(Operations.java:217)
      	at org.sonatype.nexus.transaction.Operations.call(Operations.java:166)
      	at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder$OrientWorker.lambda$5(OrientMetadataRebuilder.java:352)
      	at java.lang.Iterable.forEach(Iterable.java:75)
      	at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder$OrientWorker.refreshArtifact(OrientMetadataRebuilder.java:350)
      	at org.sonatype.nexus.repository.maven.internal.hosted.metadata.AbstractMetadataRebuilder$Worker.refreshMetadata(AbstractMetadataRebuilder.java:293)
      	at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder.refreshInTransaction(OrientMetadataRebuilder.java:145)
      	at org.sonatype.nexus.repository.maven.internal.orient.MavenFacetImpl.rebuildMetadata(MavenFacetImpl.java:281)
      	at org.sonatype.nexus.repository.maven.internal.orient.MavenFacetImpl.doGet(MavenFacetImpl.java:251)
      	at org.sonatype.nexus.transaction.TransactionalWrapper.proceedWithTransaction(TransactionalWrapper.java:58)
      	at org.sonatype.nexus.transaction.TransactionInterceptor.proceedWithTransaction(TransactionInterceptor.java:66)
      	at org.sonatype.nexus.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:55)
      	at org.sonatype.nexus.repository.maven.internal.orient.MavenFacetImpl.get(MavenFacetImpl.java:231)
      	at org.sonatype.nexus.repository.maven.internal.hosted.HostedHandler.doGet(HostedHandler.java:74)
      	at org.sonatype.nexus.repository.maven.internal.hosted.HostedHandler.handle(HostedHandler.java:60)
      	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
      

      This problem occurs when the pom's packaging is not "pom", but there is no associated artifact. In the case above the packaging was "maven-plugin", but here was no jar file.

      Actual:

      • Running the mentioned task causes NullPointerException.

      Impact:

      • This task failure occurs, and it causes the rebuild metadata to fail.

      Expected:

      • NullPointerException should be avoided.

      Workaround:

      • Run "Repair - Rebuild Maven repository metadata" task, without setting "Rebuild Checksums" to avoid the need to check for the jar.

        Attachments

          Activity

            People

            Assignee:
            lgonzalez2 Luis Gonzalez
            Reporter:
            jsensharma Jay Kumar SenSharma
            Last Updated By:
            Luis Gonzalez Luis Gonzalez
            Team:
            NXRM - Mad Max
            Owner:
            Luis Gonzalez Luis Gonzalez
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response:

                tigCommentSecurity.panel-title