You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by "Gustavo Martin (Jira)" <ji...@apache.org> on 2020/05/02 22:17:00 UTC
[jira] [Created] (SUBMARINE-487) submarine-spark-security: JNA does
not work in uber jar
Gustavo Martin created SUBMARINE-487:
----------------------------------------
Summary: submarine-spark-security: JNA does not work in uber jar
Key: SUBMARINE-487
URL: https://issues.apache.org/jira/browse/SUBMARINE-487
Project: Apache Submarine
Issue Type: Bug
Components: Security
Reporter: Gustavo Martin
In order to create an uber jar, Java packages must be renamed. Renaming packages make JNI fail.
1. ranger-plugins-common requires JNA through com.kstruct:gethostname4j
See the following code: [https://github.com/apache/ranger/blob/release-ranger-2.0.0/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTUtils.java#L83]
2. gethostname4j uses JNA, through net.java.dev.jna:jna
See the followingcode: [https://github.com/mattsheppard/gethostname4j/blob/master/src/main/java/com/kstruct/gethostname4j/Hostname.java#L30]
3. net.java.dev.jna:jna uses JNI
See the following code: [https://github.com/java-native-access/jna/blob/master/src/com/sun/jna/Native.java#L1018]
The native library used by JNA is libjnidispatch.so.
libjnidispatch.so was compiled with the package com.sun.jna (example for linux-x86-64):
{noformat}
readelf -aW libjnidispatch.so | grep Java_com_sun_jna_Native_getNativeVersion
178: 000000000000bde0 24 FUNC GLOBAL DEFAULT 12 Java_com_sun_jna_Native_getNativeVersion
227: 000000000000bde0 24 FUNC GLOBAL DEFAULT 12 Java_com_sun_jna_Native_getNativeVersion
{noformat}
Because maven-shade-plugin renames packages, JNA fails when trying to call the native method getNativeVersion (which is always called when using JNA for the first time):
{noformat}
Exception in thread "HiveServer2-Handler-Pool: Thread-81" java.lang.UnsatisfiedLinkError: submarine_spark_ranger_project.com.sun.jna.Native.getNativeVersion()Ljava/lang/String;
at submarine_spark_ranger_project.com.sun.jna.Native.getNativeVersion(Native Method)
at submarine_spark_ranger_project.com.sun.jna.Native.<clinit>(Native.java:197)
at submarine_spark_ranger_project.com.kstruct.gethostname4j.Hostname$UnixCLibrary.<clinit>(Hostname.java:12)
at submarine_spark_ranger_project.com.kstruct.gethostname4j.Hostname.getHostname(Hostname.java:30)
at org.apache.ranger.plugin.util.RangerRESTUtil
{noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org