I developed an analyzer plug-in. The plug-in uses a C language so library file, but when I call the plug-in word segmentation, the local library link fails.
Caused by:
java.lang.UnsatisfiedLinkError:
com.***.JNIWrapper.seg_segment(Ljava/lang/String;IZZLjava/lang/String;)Ljava/lang/String;
Caused by:
org.elasticsearch.ElasticsearchException: failed to analyze;
I've tried the following in the plugin's plugin-security.policy file:
grant codeBase
"/opt/elasticsearch/elasticsearch-7.1.0/plugins/analysis-plugin/plugin.jar"
{
permission java.security.AllPermission;
permission java.lang.RuntimePermission "createClassLoader";
permission java.lang.RuntimePermission "getProtectionDomain";
permission java.lang.RuntimePermission "getClassLoader";
permission java.io.FilePermission
"/opt/elasticsearch/elasticsearch-7.1.0/plugins/analysis-
plugin/Linux-amd64-64/lib.so", "read";
};
But this doesn't work.
I solved my problem by "AccessController.doPrivileged" and thank you guys.