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

db migrator can fail using oracle JDK 8 instead of OpenJDK 8

Details

    • 3
    • NXRM Neo Groomed
    • 2
    • 2

    Description

      The DB migrator tool may fail with errors like this when run with Oracle JDK 8:

      Caused by: java.util.jar.JarException: file:/tmp/nexus-db-migrator-3.33.0-01.jar has unsigned entries - com/sonatype/nexus/db/migrator/processor/CapabilityProcessor.class
      at javax.crypto.JarVerifier.verifySingleJar(JarVerifier.java:502)
      at javax.crypto.JarVerifier.verifyJars(JarVerifier.java:363)
      at javax.crypto.JarVerifier.verify(JarVerifier.java:289)

      or

      16:36:55 [main] WARN  o.s.c.a.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'batchConfig': Unsatisfied dependency expressed through method 'setProcessorConfig' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'processorConfig' defined in URL [jar:file:/home/astrachan/Desktop/nexus-db-migrator-3.33.0-01.jar!/com/sonatype/nexus/db/migrator/config/ProcessorConfig.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cipherHandler' defined in class path resource [com/sonatype/nexus/db/migrator/config/CipherConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.sonatype.nexus.db.migrator.utils.CipherHandler]: Factory method 'cipherHandler' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pbeCipher' defined in class path resource [com/sonatype/nexus/db/migrator/config/CipherConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonatype.nexus.crypto.PbeCipherFactory$PbeCipher]: Factory method 'pbeCipher' threw exception; nested exception is java.lang.SecurityException: JCE cannot authenticate the provider BC
      16:36:55 [main] INFO  o.s.b.a.l.ConditionEvaluationReportLoggingListener -
      
      ...
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pbeCipher' defined in class path resource [com/sonatype/nexus/db/migrator/config/CipherConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonatype.nexus.crypto.PbeCipherFactory$PbeCipher]: Factory method 'pbeCipher' threw exception; nested exception is java.lang.SecurityException: JCE cannot authenticate the provider BC        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:657)
              at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:485)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
              at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
              at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.resolveBeanReference(ConfigurationClassEnhancer.java:362)
              at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:334)
              at com.sonatype.nexus.db.migrator.config.CipherConfig$$EnhancerBySpringCGLIB$$e58250fe.pbeCipher(<generated>)
              
      

      The docs have one simple line which is not specific enough stating the requirements:

      https://help.sonatype.com/repomanager3/new-database-options/migrating-to-a-new-database#MigratingtoaNewDatabase-MigrationEnvironment

      The migrator utility requires OpenJDK 8.

      OpenJDK is the underlying implementation of Java. There is no statement indicating Oracle JDK will not work.

      Workaround

      Use a latest OpenJDK 8 build ( AdoptOpenJDK ) java to run the migrator.

      Expected

      Allow the tool to run with Oracle JDK distribution or document the requirements better and fail with a more clear error if using an incompatible distribution of Java.

      Attachments

        Activity

          People

            Unassigned Unassigned
            plynch Peter Lynch
            Michael Martz Michael Martz
            NXRM - Neo
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:

              tigCommentSecurity.panel-title