Uploaded image for project: 'Ranger'
  1. Ranger
  2. RANGER-4739

Unit test failures in KnoxRangerTest for JDK 17

    XMLWordPrintableJSON

Details

    • Task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Ranger
    • None

    Description

      Build in master branch (mvn clean compile package install) fails due to KnoxRangerTest class:

      ERROR Error in generating certificate: java.lang.IllegalAccessException: class org.apache.knox.gateway.util.X509CertificateUtil cannot access class sun.security.x509.X509CertInfo (in module java.base) because module java.base does not export sun.security.x509 to unnamed module @148080bb
      java.lang.IllegalAccessException: class org.apache.knox.gateway.util.X509CertificateUtil cannot access class sun.security.x509.X509CertInfo (in module java.base) because module java.base does not export sun.security.x509 to unnamed module @148080bb
      	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
      	at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)
      	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:489)
      	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
      	at org.apache.knox.gateway.util.X509CertificateUtil.generateCertificate(X509CertificateUtil.java:69)
      	at org.apache.knox.gateway.services.security.impl.DefaultKeystoreService.addCertForGateway(DefaultKeystoreService.java:186)
      	at org.apache.knox.gateway.services.security.impl.DefaultKeystoreService.addSelfSignedCertForGateway(DefaultKeystoreService.java:166)
      	at org.apache.knox.gateway.services.security.impl.DefaultKeystoreService.addSelfSignedCertForGateway(DefaultKeystoreService.java:160)
      	at org.apache.knox.gateway.services.security.impl.JettySSLService.init(JettySSLService.java:88)
      	at org.apache.knox.gateway.services.DefaultGatewayServices.init(DefaultGatewayServices.java:104)
      	at org.apache.knox.gateway.GatewayTestDriver.setupGateway(GatewayTestDriver.java:162)
      	at org.apache.ranger.services.knox.KnoxRangerTest.setupSuite(KnoxRangerTest.java:60)
      
      [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 7.266 s <<< FAILURE! - in org.apache.ranger.services.knox.KnoxRangerTest
      [ERROR] org.apache.ranger.services.knox.KnoxRangerTest  Time elapsed: 7.266 s  <<< ERROR!
      java.lang.NullPointerException: Cannot invoke "java.security.cert.Certificate.getEncoded()" because "entry.chain[i]" is null
      	at java.base/sun.security.provider.JavaKeyStore.engineStore(JavaKeyStore.java:606)
      	at java.base/sun.security.util.KeyStoreDelegator.engineStore(KeyStoreDelegator.java:190)
      	at java.base/java.security.KeyStore.store(KeyStore.java:1404)
      	at org.apache.knox.gateway.services.security.impl.DefaultKeystoreService.writeKeyStoreToFile(DefaultKeystoreService.java:503)
      	at org.apache.knox.gateway.services.security.impl.DefaultKeystoreService.addCertForGateway(DefaultKeystoreService.java:194)
      	at org.apache.knox.gateway.services.security.impl.DefaultKeystoreService.addSelfSignedCertForGateway(DefaultKeystoreService.java:166)
      	at org.apache.knox.gateway.services.security.impl.DefaultKeystoreService.addSelfSignedCertForGateway(DefaultKeystoreService.java:160)
      	at org.apache.knox.gateway.services.security.impl.JettySSLService.init(JettySSLService.java:88)
      	at org.apache.knox.gateway.services.DefaultGatewayServices.init(DefaultGatewayServices.java:104)
      	at org.apache.knox.gateway.GatewayTestDriver.setupGateway(GatewayTestDriver.java:162)
      	at org.apache.ranger.services.knox.KnoxRangerTest.setupSuite(KnoxRangerTest.java:60)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
      
      [INFO] 
      [INFO] Results:
      [INFO] 
      [ERROR] Errors: 
      [ERROR]   KnoxRangerTest.setupSuite:60 » NullPointer Cannot invoke "java.security.cert.Certificate.getEncoded()" because "entry.chain[i]" is null
      [INFO] 
      [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
      

      Even after handling above JDK 17 error through config "--add-exports java.base/sun.security.x509=ALL-UNNAMED" , its give Error

      ERROR Error in generating certificate: java.lang.NoSuchFieldException: md5WithRSAEncryption_oid
      java.lang.NoSuchFieldException: md5WithRSAEncryption_oid
      	at java.base/java.lang.Class.getDeclaredField(Class.java:2610)
      	at org.apache.knox.gateway.util.X509CertificateUtil.generateCertificate(X509CertificateUtil.java:146)
      	at org.apache.knox.gateway.services.security.impl.DefaultKeystoreService.addCertForGateway(DefaultKeystoreService.java:186)
      	at org.apache.knox.gateway.services.security.impl.DefaultKeystoreService.addSelfSignedCertForGateway(DefaultKeystoreService.java:166)
      	at org.apache.knox.gateway.services.security.impl.DefaultKeystoreService.addSelfSignedCertForGateway(DefaultKeystoreService.java:160)
      	at org.apache.knox.gateway.services.security.impl.JettySSLService.init(JettySSLService.java:88)
      	at org.apache.knox.gateway.services.DefaultGatewayServices.init(DefaultGatewayServices.java:104)
      	at org.apache.knox.gateway.GatewayTestDriver.setupGateway(GatewayTestDriver.java:162)
      	at org.apache.ranger.services.knox.KnoxRangerTest.setupSuite(KnoxRangerTest.java:60)
      
      [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 6.42 s <<< FAILURE! - in org.apache.ranger.services.knox.KnoxRangerTest
      [ERROR] org.apache.ranger.services.knox.KnoxRangerTest  Time elapsed: 6.42 s  <<< ERROR!
      java.lang.NullPointerException: Cannot invoke "java.security.cert.Certificate.getEncoded()" because "entry.chain[i]" is null
      	at java.base/sun.security.provider.JavaKeyStore.engineStore(JavaKeyStore.java:606)
      	at java.base/sun.security.util.KeyStoreDelegator.engineStore(KeyStoreDelegator.java:190)
      	at java.base/java.security.KeyStore.store(KeyStore.java:1404)
      	at org.apache.knox.gateway.services.security.impl.DefaultKeystoreService.writeKeyStoreToFile(DefaultKeystoreService.java:503)
      	at org.apache.knox.gateway.services.security.impl.DefaultKeystoreService.addCertForGateway(DefaultKeystoreService.java:194)
      	at org.apache.knox.gateway.services.security.impl.DefaultKeystoreService.addSelfSignedCertForGateway(DefaultKeystoreService.java:166)
      	at org.apache.knox.gateway.services.security.impl.DefaultKeystoreService.addSelfSignedCertForGateway(DefaultKeystoreService.java:160)
      	at org.apache.knox.gateway.services.security.impl.JettySSLService.init(JettySSLService.java:88)
      	at org.apache.knox.gateway.services.DefaultGatewayServices.init(DefaultGatewayServices.java:104)
      	at org.apache.knox.gateway.GatewayTestDriver.setupGateway(GatewayTestDriver.java:162)
      	at org.apache.ranger.services.knox.KnoxRangerTest.setupSuite(KnoxRangerTest.java:60)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
      
      [INFO] Results:
      [INFO] 
      [ERROR] Errors: 
      [ERROR]   KnoxRangerTest.setupSuite:60 » NullPointer Cannot invoke "java.security.cert.Certificate.getEncoded()" because "entry.chain[i]" is null
      [INFO] 
      [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
      

       

      Attachments

        Issue Links

          Activity

            People

              rakeshgupta264 Rakesh Gupta
              rakeshgupta264 Rakesh Gupta
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: