Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-10363

Nifi Registry start fail with NoClassDefFoundError: software/amazon/awssdk/auth/credentials/AwsCredentials

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.17.0
    • 1.18.0
    • NiFi Registry
    • None

    Description

      In https://issues.apache.org/jira/browse/NIFI-9848, the maven-assembly-plugin version is increased 3.3.0 from 2.4.3 in nifi-registry.

      Because of that some of the AWS libraries are not included into lib/spp directory, which cause the following error, if nifi-registry.properties contains encrypted values:

      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr Exception in thread "main" java.lang.RuntimeException: Unable to load properties: java.lang.IllegalArgumentException: There was an issue decrypting protected properties
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at org.apache.nifi.registry.NiFiRegistry.main(NiFiRegistry.java:164)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr Caused by: java.lang.IllegalArgumentException: There was an issue decrypting protected properties
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at org.apache.nifi.registry.NiFiRegistry.initializeProperties(NiFiRegistry.java:207)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at org.apache.nifi.registry.NiFiRegistry.main(NiFiRegistry.java:162)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr Caused by: java.lang.NoClassDefFoundError: software/amazon/awssdk/auth/credentials/AwsCredentials
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at org.apache.nifi.properties.StandardSensitivePropertyProviderFactory.getProvider(StandardSensitivePropertyProviderFactory.java:205)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at org.apache.nifi.properties.StandardSensitivePropertyProviderFactory.getSupportedProviders(StandardSensitivePropertyProviderFactory.java:152)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at org.apache.nifi.registry.properties.NiFiRegistryPropertiesLoader.load(NiFiRegistryPropertiesLoader.java:130)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at org.apache.nifi.registry.properties.NiFiRegistryPropertiesLoader.load(NiFiRegistryPropertiesLoader.java:146)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at java.lang.reflect.Method.invoke(Method.java:498)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at org.apache.nifi.registry.NiFiRegistry.initializeProperties(NiFiRegistry.java:202)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	... 1 more
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr Caused by: java.lang.ClassNotFoundException: software.amazon.awssdk.auth.credentials.AwsCredentials
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
      2022-08-15 17:54:36,077 ERROR [NiFi logging handler] org.apache.nifi.registry.StdErr 	... 17 more 

      Reproduce the issue

      1. Download nifi-registry 1.17.0 binary
      2. Download nifi-toolkit 1.17.0n binary
      3. Uncompress it
      4. Configure nifi-registry.properties to encrypt some sensitive key. For example I did the following:
        nifi.registry.sensitive.props.additional.keys=nifi.registry.security.authorizers.configuration.file
        
      1. Execute this from conf directory:
        ../../nifi-toolkit-1.17.0/bin/encrypt-config.sh --nifiRegistry \
        -b bootstrap.conf \
        -k 0123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA9876543210 \
        -r nifi-registry.properties
        
      2. Start nifi-registry, the bootstrap log will contain the error and nifi-registry won't start

      Suggested solution:
      Add

      <include>software.amazon.awssdk:*</include>

      to nifi-registry-assembly dependencies.xml

      More details why this happens
      In nifi registy there are two libs which use software.amazon.awssdk:auth dependency:

      • nifi-property-protection-aws which use 2.17.106 version and that is used in nifi-registry-properties-loader
      • nifi-registry-aws which use 2.5.9 version

      The maven-assembly-library use a maven-core lib, which returns the resolved artifacts what the plugin use. In case of maven-assembly-plugin 2.4.3 the resolved artifact is software.amazon.awssdk:auth:2.5.9 but the depTrail contained a reference for nifi-registry-properties-loader, that is why 2.5.9 is included in lib/spp path.

      However in case of maven-assembly-plugin 3.3.0, the software.amazon.awssdk:auth:2.5.9 depTrail contains reference for nifi-registry-aws, that's why the necessary lib no longer included.

      Probably in an another ticket, it would worth to adress the problem that some of the aws libs in lib/spp versions are 2.17.106 but others resolved to 2.5.9

      Attachments

        Issue Links

          Activity

            People

              taz1988 Zoltán Kornél Török
              taz1988 Zoltán Kornél Török
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h