愚者求师之过,智者从师之长。

es 自定义插件问题

Elasticsearch | 作者 zhangyu22 | 发布于2018年07月27日 | 阅读数:3608

在用bin启动es时,报错:
[2018-07-27T11:29:26,341][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [] fatal error in thread [elasticsearch[p1NIdjY][index][T#1]], exiting
java.lang.ExceptionInInitializerError: null
at com.hankcs.hanlp.seg.common.Vertex.<clinit>(Vertex.java:56) ~[?:?]
at com.hankcs.hanlp.seg.common.WordNet.<init>(WordNet.java:71) ~[?:?]
at com.hankcs.hanlp.seg.Viterbi.ViterbiSegment.segSentence(ViterbiSegment.java:40) ~[?:?]
at com.hankcs.hanlp.seg.Segment.seg(Segment.java:422) ~[?:?]
at com.hankcs.lucene4.HanlpSegmenter.next(HanlpSegmenter.java:64) ~[?:?]
at com.hankcs.lucene4.HanLPTokenizer.incrementToken(HanLPTokenizer.java:46) ~[?:?]
at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.simpleAnalyze(TransportAnalyzeAction.java:266) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.analyze(TransportAnalyzeAction.java:243) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:164) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:80) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:293) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:286) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:30) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:66) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:656) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:672) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.2.3.jar:6.2.3]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_131]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]
Caused by: java.lang.SecurityException: java.lang.System#exit(-1) calls are not allowed
at org.elasticsearch.SecureSM$2.run(SecureSM.java:245) ~[securesm-1.2.jar:6.2.3]
at org.elasticsearch.SecureSM$2.run(SecureSM.java:212) ~[securesm-1.2.jar:6.2.3]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_131]
at org.elasticsearch.SecureSM.innerCheckExit(SecureSM.java:212) ~[securesm-1.2.jar:6.2.3]
at org.elasticsearch.SecureSM.checkExit(SecureSM.java:203) ~[securesm-1.2.jar:6.2.3]
at java.lang.Runtime.exit(Runtime.java:107) ~[?:1.8.0_131]
at java.lang.System.exit(System.java:971) ~[?:1.8.0_131]
at com.hankcs.hanlp.dictionary.CoreDictionary.<clinit>(CoreDictionary.java:43) ~[?:?]
... 20 more
已邀请:

rochy - rochy_he

赞同来自: zhangyu22

修改jre的police文件,允许hanlp文件夹的写入权限;
cd /JAVA_HOME/jre/lib/security/ 
vim java.policy

permission java.io.FilePermission "/hanlp字典路径/-", "write";
permission java.security.AllPermission;

 

kepmoving - 90后

赞同来自:

permission java.util.PropertyPermission "file.encoding", "read";
permission java.security.AllPermission;
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
  permission java.lang.RuntimePermission "getClassLoader";
  permission org.elasticsearch.script.ClassPermission "com.hankcs.*";
 

要回复问题请先登录注册