RANGER-5530: Fix for KMS API not working in docker kerberos env#1004
Conversation
| <include>com.fasterxml.jackson.core:jackson-core:jar:${fasterxml.jackson.version}</include> | ||
| <include>com.fasterxml.jackson.core:jackson-databind:jar:${fasterxml.jackson.databind.version}</include> | ||
| <include>org.javassist:javassist</include> | ||
| <include>org.apache.ranger:ranger-common-utils</include> |
There was a problem hiding this comment.
The fix makes sense moving ranger-common-utils to WEB-INF/lib eliminates the dual classloader loading of Jackson. A couple of things worth verifying:
1--> Are there any other jars remaining in the ews/lib moduleSet that are also present in WEB-INF/lib? If so, we'd have the same loader constraint risk for those classes once WEB-INF/lib/* is added to the JVM classpath (see comment on kms/scripts/ranger-kms).
2--> Is there anything in the KMS startup lifecycle that runs before the webapp classloader is active and depends on ranger-common-utils? Since it's no longer in ews/lib, it won't be available at the JVM level until Tomcat loads the webapp
There was a problem hiding this comment.
@pradeepagrawal8184 could you weigh in on this? I think you'd have better insight into whether the classpath overlap is actually a concern here. Check my other comment as well.
There was a problem hiding this comment.
@vyommani , I have addressed the concern you raised. I have added the required dependency to be loaded by the same class loader where it is required. Earlier JsonUtils2 was being loaded by one loader and dependent jar was being loaded by another loader. Now this would not be the case.
Pls review one more time. Thanks.
Ranger-KMS APIs (including dev_kms TestConnection) were breaking due to authentication & authorisation error after kerberos implementation in Docker env.
This PR contains fix for following:
After kerberos fix, it was throwing following error:
As per my analysis, it happened due to duplicate jackson-*:jar jars available inside distro/kms.xml . Once inside "ews/webapp/WEB-INF/lib/" and once inside "ews/lib".
RCA: "ranger-common-utils" was part of "ews/lib" and Jackson jars were part of both moduleSets. JsonUtilsV2.java tries to load com.fasterxml.jackson.databind.ObjectMapper . It's part of Jackson jars and it was already loaded by another class loader. That is, once it gets loaded by the app loader, then the webapp loader tries to load it again → loader constraint violation → JsonUtilsV2 cannot initialize.
Fix: : Removed ranger-common-utils dependency & Jackson-*.jar from ews/lib and added ranger-common-utils inside "ews/webapp/WEB-INF/lib/".
How was this patch tested?
-mvn build is working