Closed IharReznichenka closed 1 year ago
I was able to make it work (details below), but such a ClassLoader setup is not an option in our case because it brings a lot of unnecessary dependencies to other webapps. It would be great to hear your idea if there are other options.
The main idea is to use the Shared ClassLoader - https://tomcat.apache.org/tomcat-9.0-doc/class-loader-howto.html
conf/catalina.properties
shared.loader="${catalina.base}/shared-lib-3rd-party"
shared-lib-3rd-party
aws-msk-iam-auth-jar-with-dependencies.jar
pom.xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-bom</artifactId>
<version>1.11.986</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.17.122</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-sts</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>auth</artifactId>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>software.amazon.msk</groupId>
<artifactId>aws-msk-iam-auth</artifactId>
<version>1.1.4</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.4.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
This is the same root cause as https://github.com/aws/aws-msk-iam-auth/issues/36
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.
Hello,
There are some similar tickets already created but the context is a bit different here.
It seems that the issue here is the class software.amazon.msk.auth.iam.internals.AWSCredentialsCallback was previously loaded by the
app1
and can't be used by theapp2
. It's a bit confusing why app2 tries to use the class loaded by app1 taking into consideration that they have different contexts.The setup is following:
Configuration is the same for both apps except the profile name
It works fine when there is only one app deployed that uses aws-msk-iam-auth. But as soon as there are two apps, the first one loads fine but during the deployment of the second app, we start seeing the exception above.
Can you please advise if there is something wrong with the configuration or should we meet some specific deployment requirement to be able to use the lib?
Please let me know if any additional information is required here.