duydo / elasticsearch-analysis-vietnamese

Vietnamese Analysis Plugin for Elasticsearch
Apache License 2.0
505 stars 211 forks source link

java.security.AccessControlException: access denied on Startup. #80

Closed tyrantkhan closed 3 years ago

tyrantkhan commented 4 years ago

Hi I'm using ES 6.8.6 and I was able to install the binary on startup running into an issue:

java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers") elasticsearch6 | at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) ~[?:1.8.0_201] elasticsearch6 | at java.security.AccessController.checkPermission(AccessController.java:884) ~[?:1.8.0_201] elasticsearch6 | at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) ~[?:1.8.0_201] elasticsearch6 | at java.lang.Class.checkMemberAccess(Class.java:2348) ~[?:1.8.0_201] elasticsearch6 | at java.lang.Class.getDeclaredField(Class.java:2067) ~[?:1.8.0_201] elasticsearch6 | at com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator.getDeclaredField(ReflectionNavigator.java:273) ~[?:?] elasticsearch6 | at com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator.getDeclaredField(ReflectionNavigator.java:47) ~[?:?] elasticsearch6 | at com.sun.xml.internal.bind.v2.model.impl.RegistryInfoImpl.<init>(RegistryInfoImpl.java:70) ~[?:?] elasticsearch6 | at com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.addRegistry(ModelBuilder.java:402) ~[?:?] elasticsearch6 | at com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:372) ~[?:?] elasticsearch6 | at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:439) ~[?:?] elasticsearch6 | at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:277) ~[?:?] elasticsearch6 | at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:124) ~[?:?] elasticsearch6 | at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1123) ~[?:?] elasticsearch6 | at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:147) ~[?:?] elasticsearch6 | at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:271) ~[?:?] elasticsearch6 | at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) ~[?:?] elasticsearch6 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] elasticsearch6 | at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_201] elasticsearch6 | at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:171) ~[?:1.8.0_201] elasticsearch6 | at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:131) ~[?:1.8.0_201] elasticsearch6 | at javax.xml.bind.ContextFinder.find(ContextFinder.java:356) ~[?:1.8.0_201] elasticsearch6 | at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:431) ~[?:1.8.0_201] elasticsearch6 | at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:394) ~[?:1.8.0_201] elasticsearch6 | at vn.hus.nlp.lexicon.LexiconUnmarshaller.createContext(LexiconUnmarshaller.java:42) ~[?:?] elasticsearch6 | at vn.hus.nlp.lexicon.LexiconUnmarshaller.<init>(LexiconUnmarshaller.java:35) ~[?:?] elasticsearch6 | at me.duydo.vi.Tokenizer.loadLexerRules(Tokenizer.java:57) ~[?:?] elasticsearch6 | at me.duydo.vi.Tokenizer.init(Tokenizer.java:45) ~[?:?] elasticsearch6 | at me.duydo.vi.Tokenizer.<init>(Tokenizer.java:38) ~[?:?] elasticsearch6 | at org.elasticsearch.index.analysis.VietnameseTokenizerFactory.<init>(VietnameseTokenizerFactory.java:31) ~[?:?] elasticsearch6 | at org.elasticsearch.index.analysis.AnalysisRegistry.buildMapping(AnalysisRegistry.java:379) ~[elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.index.analysis.AnalysisRegistry.buildTokenizerFactories(AnalysisRegistry.java:189) ~[elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.index.analysis.AnalysisRegistry.build(AnalysisRegistry.java:163) ~[elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.index.IndexModule.newIndexService(IndexModule.java:407) ~[elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.indices.IndicesService.createIndexService(IndicesService.java:525) ~[elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:479) ~[elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService.validateAndAddTemplate(MetaDataIndexTemplateService.java:235) ~[elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService.access$300(MetaDataIndexTemplateService.java:65) ~[elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService$2.execute(MetaDataIndexTemplateService.java:176) ~[elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.cluster.ClusterStateUpdateTask.execute(ClusterStateUpdateTask.java:47) ~[elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:643) ~[elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.cluster.service.MasterService.calculateTaskOutputs(MasterService.java:270) ~[elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.cluster.service.MasterService.runTasks(MasterService.java:200) [elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.cluster.service.MasterService$Batcher.run(MasterService.java:135) [elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.cluster.service.TaskBatcher.runIfNotProcessed(TaskBatcher.java:150) [elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.cluster.service.TaskBatcher$BatchedTask.run(TaskBatcher.java:188) [elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:681) [elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:252) [elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:215) [elasticsearch-6.8.6.jar:6.8.6] elasticsearch6 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_201] elasticsearch6 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_201] elasticsearch6 | at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]

I've uploaded the binary here: https://github.com/tyrantkhan/elasticsearch-analysis-vietnamese/releases/download/v6.8.2/analysis-vietnamese-6.8.6.3-plugin.1.zip

MunKeat commented 4 years ago

@tyrantkhan I think I have the same issue as you - I managed to compile successfully on the first round - but subsequent round, the compilation failed with the attached error.log.

I did checkout the branch feature/v6.8.2 before compilation - however, I compiled against Elasticsearch version 6.8.5 (by changing the pom.xml file) and following the guide in https://duydo.me/how-to-build-elasticsearch-vietnamese-analysis-plugin/

I hope you don't mind that I am sharing this in this thread as well - cos the issue you are facing is quite similar to mine, and given that it is on Elasticsearch version 6, I suspect the cause is similar.

duydo commented 4 years ago

@tyrantkhan @MunKeat can you start that Elasticsearch version without the plugin?

I've just built the plugin for Elasticsearch v6.8.2 and installed the plugin successfully.

....
[2020-06-03T17:52:39,338][INFO ][o.e.p.PluginsService     ] [Fp8dLUH] loaded module [x-pack-watcher]
[2020-06-03T17:52:39,339][INFO ][o.e.p.PluginsService     ] [Fp8dLUH] loaded plugin [elasticsearch-analysis-vietnamese]
[2020-06-03T17:52:42,734][INFO ][o.e.x.s.a.s.FileRolesStore] [Fp8dLUH] parsed [0] roles from file [/Users/duydo/.evm/elasticsearch/config/roles.yml]
[2020-06-03T17:52:43,328][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [Fp8dLUH] [controller/15077] [Main.cc@109] controller (64 bit): Version 6.8.2 (Build f4a9b28c0d5114) Copyright (c) 2019 Elasticsearch BV
.....

[2020-06-03T17:52:44,858][INFO ][o.e.n.Node               ] [Fp8dLUH] starting ...
[2020-06-03T17:52:45,021][INFO ][o.e.t.TransportService   ] [Fp8dLUH] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
MunKeat commented 4 years ago

Yes, starting Elasticsearch version 6.8.5 by itself is fine

tyrantkhan commented 4 years ago

I can install the plugin fine, but using it is where issues begin.there were a couple issues -

I had to move:

https://github.com/duydo/vn-nlp-libraries/blob/master/nlp-parent/nlp-tokenizer/src/main/java/me/duydo/vi/Tokenizer.java

from the package me.duydo.vi to vn.hus.nlp

Additionally i had to revert the changes in that file caused by

https://github.com/duydo/vn-nlp-libraries/commit/edd770edde2bdad654a6bb66f2ed723648a4defa

Doing those two things allowed me to use the plugin

MunKeat commented 4 years ago

For me, this is the modification I had to make as recommended by Elastic. The error goes away once the fix is added.

I have submitted a merge request - https://github.com/duydo/elasticsearch-analysis-vietnamese/pull/83

Reference: https://www.elastic.co/guide/en/elasticsearch/plugins/current/plugin-authors.html

duydo commented 4 years ago

For me, this is the modification I had to make as recommended by Elastic. The error goes away once the fix is added.

I have submitted a merge request - #83

Thanks @MunKeat for your PR. I'll merge it.