Zoltán Kornél Török created NIFI-10363:
------------------------------------------

             Summary: Nifi Registry start fail with NoClassDefFoundError: 
software/amazon/awssdk/auth/credentials/AwsCredentials
                 Key: NIFI-10363
                 URL: https://issues.apache.org/jira/browse/NIFI-10363
             Project: Apache NiFi
          Issue Type: Bug
          Components: NiFi Registry
    Affects Versions: 1.17.0
            Reporter: Zoltán Kornél Török
            Assignee: Zoltán Kornél Török
             Fix For: 1.18.0


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:
{code:java}
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 {code}
*Reproduce the issue*
 # Download nifi-registry 1.17.0 binary
 # Download nifi-toolkit 1.17.0n binary
 # Uncompress it
 # Configure nifi-registry.properties to encrypt some sensitive key. For 
example I did the following:
{code:java}
nifi.registry.sensitive.props.additional.keys=nifi.registry.security.authorizers.configuration.file
{code}

 # Execute this from conf directory:
{code:java}
../../nifi-toolkit-1.17.0/bin/encrypt-config.sh --nifiRegistry \
-b bootstrap.conf \
-k 0123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA9876543210 \
-r nifi-registry.properties
{code}
# Start nifi-registry, the bootstrap log will contain the error and 
nifi-registry won't start

*Suggested solution:*
Add {code}<include>software.amazon.awssdk:*</include>{code}
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



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to