记录elasticsearch-analysis-dynamic-synonym从8.15.0升级到8.16.0所遇到的问题
一、打包步骤
步骤一、linux系统下执行elasticsearch-module中的build.sh脚本
步骤二、maven环境下elasticsearch-cluster-runner执行maven install命令安装到本地maven仓库。
步骤三、修改版本号打包插件
二、记录步骤一到步骤二出现的问题
8.15.0是有这两个包的,但是到了8.16.0官方将这两个包去除了,看PR记录大致理由是说plugin-classloader这个插件类加载器重复了,去除了也不影响elasticsearch的正常工作,但是我一脸疑问,哥们您们没有考虑到下游插件synonym呀,这就属实有点难崩了,不过就这小问题,难不倒博主,我细看一下代码记录就知道如何解决问题了。
将elasticsearch-cluster-runner
中pom.xml
这部分代码删除就可以了,然后继续maven install就没有问题啦。
三、将打包好的文件解压缩到es的plugin目录下出现数据库权限问题
当我装好同义词插件之后,发现了这个问题,经过我多番思考之后,看了一下日志,原来是权限的问题。
[2024-11-18T23:08:25,151][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [JAVAGPT] fatal error in thread [elasticsearch[JAVAGPT][clusterApplierService#updateTask][T#1]], exiting
java.lang.ExceptionInInitializerError: null
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.loadAuthenticationPlugins(NativeAuthenticationProvider.java:246) ~[?:?]
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:387) ~[?:?]
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:174) ~[?:?]
at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1348) ~[?:?]
at com.mysql.cj.NativeSession.connect(NativeSession.java:157) ~[?:?]
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:956) ~[?:?]
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:826) ~[?:?]
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456) ~[?:?]
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) ~[?:?]
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[?:?]
at java.sql.DriverManager.getConnection(DriverManager.java:682) ~[java.sql:?]
at java.sql.DriverManager.getConnection(DriverManager.java:230) ~[java.sql:?]
at com.bellszhu.elasticsearch.plugin.synonym.analysis.MySqlRemoteSynonymFile.getConnection(MySqlRemoteSynonymFile.java:244) ~[?:?]
at com.bellszhu.elasticsearch.plugin.synonym.analysis.MySqlRemoteSynonymFile.getMySqlSynonymLastModify(MySqlRemoteSynonymFile.java:156) ~[?:?]
at com.bellszhu.elasticsearch.plugin.synonym.analysis.MySqlRemoteSynonymFile.isNeedReloadSynonymMap(MySqlRemoteSynonymFile.java:134) ~[?:?]
at com.bellszhu.elasticsearch.plugin.synonym.analysis.MySqlRemoteSynonymFile.<init>(MySqlRemoteSynonymFile.java:106) ~[?:?]
at com.bellszhu.elasticsearch.plugin.synonym.analysis.DynamicSynonymTokenFilterFactory.getSynonymFile(DynamicSynonymTokenFilterFactory.java:159) ~[?:?]
at com.bellszhu.elasticsearch.plugin.synonym.analysis.DynamicSynonymTokenFilterFactory.buildSynonyms(DynamicSynonymTokenFilterFactory.java:148) ~[?:?]
at com.bellszhu.elasticsearch.plugin.synonym.analysis.DynamicSynonymTokenFilterFactory.getChainAwareTokenFilterFactory(DynamicSynonymTokenFilterFactory.java:98) ~[?:?]
at org.elasticsearch.index.analysis.AnalyzerComponents.createComponents(AnalyzerComponents.java:83) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.index.analysis.CustomAnalyzerProvider.create(CustomAnalyzerProvider.java:61) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.index.analysis.CustomAnalyzerProvider.build(CustomAnalyzerProvider.java:43) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.index.analysis.AnalysisRegistry.produceAnalyzer(AnalysisRegistry.java:708) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.index.analysis.AnalysisRegistry.build(AnalysisRegistry.java:616) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.index.analysis.AnalysisRegistry.build(AnalysisRegistry.java:214) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.index.IndexModule.newIndexService(IndexModule.java:511) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.indices.IndicesService.createIndexService(IndicesService.java:761) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:651) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:189) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.indices.cluster.IndicesClusterStateService.createIndicesAndUpdateShards(IndicesClusterStateService.java:582) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.indices.cluster.IndicesClusterStateService.doApplyClusterState(IndicesClusterStateService.java:306) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.indices.cluster.IndicesClusterStateService.applyClusterState(IndicesClusterStateService.java:260) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.cluster.service.ClusterApplierService.callClusterStateAppliers(ClusterApplierService.java:544) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.cluster.service.ClusterApplierService.callClusterStateAppliers(ClusterApplierService.java:530) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.cluster.service.ClusterApplierService.applyChanges(ClusterApplierService.java:503) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.cluster.service.ClusterApplierService.runTask(ClusterApplierService.java:432) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.cluster.service.ClusterApplierService$UpdateTask.run(ClusterApplierService.java:157) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:956) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:218) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:184) ~[elasticsearch-8.16.0.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
at java.lang.Thread.run(Thread.java:1575) ~[?:?]
Caused by: java.security.AccessControlException: access denied ("java.security.SecurityPermission" "insertProvider")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:488) ~[?:?]
at java.security.AccessController.checkPermission(AccessController.java:1085) ~[?:?]
at java.lang.SecurityManager.checkPermission(SecurityManager.java:411) ~[?:?]
at java.lang.SecurityManager.checkSecurityAccess(SecurityManager.java:1517) ~[?:?]
at java.security.Security.checkInsertProvider(Security.java:802) ~[?:?]
at java.security.Security.insertProviderAt(Security.java:341) ~[?:?]
at java.security.Security.addProvider(Security.java:385) ~[?:?]
at com.mysql.cj.protocol.a.authentication.AuthenticationLdapSaslClientPlugin.<clinit>(AuthenticationLdapSaslClientPlugin.java:59) ~[?:?]
... 43 more
Suppressed: java.security.AccessControlException: access denied ("java.security.SecurityPermission" "insertProvider.MySQLScramSha1Sasl")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:488) ~[?:?]
at java.security.AccessController.checkPermission(AccessController.java:1085) ~[?:?]
at java.lang.SecurityManager.checkPermission(SecurityManager.java:411) ~[?:?]
at java.lang.SecurityManager.checkSecurityAccess(SecurityManager.java:1517) ~[?:?]
at java.security.Security.checkInsertProvider(Security.java:805) ~[?:?]
at java.security.Security.insertProviderAt(Security.java:341) ~[?:?]
at java.security.Security.addProvider(Security.java:385) ~[?:?]
at com.mysql.cj.protocol.a.authentication.AuthenticationLdapSaslClientPlugin.<clinit>(AuthenticationLdapSaslClientPlugin.java:59) ~[?:?]
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.loadAuthenticationPlugins(NativeAuthenticationProvider.java:246) ~[?:?]
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:387) ~[?:?]
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:174) ~[?:?]
at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1348) ~[?:?]
at com.mysql.cj.NativeSession.connect(NativeSession.java:157) ~[?:?]
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:956) ~[?:?]
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:826) ~[?:?]
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456) ~[?:?]
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) ~[?:?]
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[?:?]
at java.sql.DriverManager.getConnection(DriverManager.java:682) ~[java.sql:?]
at java.sql.DriverManager.getConnection(DriverManager.java:230) ~[java.sql:?]
at com.bellszhu.elasticsearch.plugin.synonym.analysis.MySqlRemoteSynonymFile.getConnection(MySqlRemoteSynonymFile.java:244) ~[?:?]
at com.bellszhu.elasticsearch.plugin.synonym.analysis.MySqlRemoteSynonymFile.getMySqlSynonymLastModify(MySqlRemoteSynonymFile.java:156) ~[?:?]
at com.bellszhu.elasticsearch.plugin.synonym.analysis.MySqlRemoteSynonymFile.isNeedReloadSynonymMap(MySqlRemoteSynonymFile.java:134) ~[?:?]
at com.bellszhu.elasticsearch.plugin.synonym.analysis.MySqlRemoteSynonymFile.<init>(MySqlRemoteSynonymFile.java:106) ~[?:?]
at com.bellszhu.elasticsearch.plugin.synonym.analysis.DynamicSynonymTokenFilterFactory.getSynonymFile(DynamicSynonymTokenFilterFactory.java:159) ~[?:?]
at com.bellszhu.elasticsearch.plugin.synonym.analysis.DynamicSynonymTokenFilterFactory.buildSynonyms(DynamicSynonymTokenFilterFactory.java:148) ~[?:?]
at com.bellszhu.elasticsearch.plugin.synonym.analysis.DynamicSynonymTokenFilterFactory.getChainAwareTokenFilterFactory(DynamicSynonymTokenFilterFactory.java:98) ~[?:?]
at org.elasticsearch.index.analysis.AnalyzerComponents.createComponents(AnalyzerComponents.java:83) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.index.analysis.CustomAnalyzerProvider.create(CustomAnalyzerProvider.java:61) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.index.analysis.CustomAnalyzerProvider.build(CustomAnalyzerProvider.java:43) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.index.analysis.AnalysisRegistry.produceAnalyzer(AnalysisRegistry.java:708) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.index.analysis.AnalysisRegistry.build(AnalysisRegistry.java:616) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.index.analysis.AnalysisRegistry.build(AnalysisRegistry.java:214) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.index.IndexModule.newIndexService(IndexModule.java:511) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.indices.IndicesService.createIndexService(IndicesService.java:761) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:651) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:189) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.indices.cluster.IndicesClusterStateService.createIndicesAndUpdateShards(IndicesClusterStateService.java:582) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.indices.cluster.IndicesClusterStateService.doApplyClusterState(IndicesClusterStateService.java:306) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.indices.cluster.IndicesClusterStateService.applyClusterState(IndicesClusterStateService.java:260) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.cluster.service.ClusterApplierService.callClusterStateAppliers(ClusterApplierService.java:544) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.cluster.service.ClusterApplierService.callClusterStateAppliers(ClusterApplierService.java:530) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.cluster.service.ClusterApplierService.applyChanges(ClusterApplierService.java:503) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.cluster.service.ClusterApplierService.runTask(ClusterApplierService.java:432) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.cluster.service.ClusterApplierService$UpdateTask.run(ClusterApplierService.java:157) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:956) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:218) ~[elasticsearch-8.16.0.jar:?]
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:184) ~[elasticsearch-8.16.0.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
at java.lang.Thread.run(Thread.java:1575) ~[?:?]
于是我就去修改elasticsearch-8.16.0\jdk\conf\security\java.policy
文件,加入SocketPermission、RuntimePermission和SecurityPermission这几行,重启之后完美解决问题。
//
// This system policy file grants a set of default permissions to all domains
// and can be configured to grant additional permissions to modules and other
// code sources. The code source URL scheme for modules linked into a
// run-time image is "jrt".
//
// For example, to grant permission to read the "foo" property to the module
// "com.greetings", the grant entry is:
//
// grant codeBase "jrt:/com.greetings" {
// permission java.util.PropertyPermission "foo", "read";
// };
//
// default permissions granted to all domains
grant {
// allows anyone to listen on dynamic ports
permission java.net.SocketPermission "localhost:0", "listen";
// "standard" properties that can be read by anyone
permission java.util.PropertyPermission "java.version", "read";
permission java.util.PropertyPermission "java.vendor", "read";
permission java.util.PropertyPermission "java.vendor.url", "read";
permission java.util.PropertyPermission "java.class.version", "read";
permission java.util.PropertyPermission "os.name", "read";
permission java.util.PropertyPermission "os.version", "read";
permission java.util.PropertyPermission "os.arch", "read";
permission java.util.PropertyPermission "file.separator", "read";
permission java.util.PropertyPermission "path.separator", "read";
permission java.util.PropertyPermission "line.separator", "read";
permission java.util.PropertyPermission
"java.specification.version", "read";
permission java.util.PropertyPermission
"java.specification.maintenance.version", "read";
permission java.util.PropertyPermission "java.specification.vendor", "read";
permission java.util.PropertyPermission "java.specification.name", "read";
permission java.util.PropertyPermission
"java.vm.specification.version", "read";
permission java.util.PropertyPermission
"java.vm.specification.vendor", "read";
permission java.util.PropertyPermission
"java.vm.specification.name", "read";
permission java.net.SocketPermission "*", "connect,resolve";
permission java.lang.RuntimePermission "setContextClassLoader";
permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.lang.RuntimePermission "createClassLoader";
permission java.security.SecurityPermission "putProviderProperty.MySQLScramSha1Sasl";
permission java.security.SecurityPermission "insertProvider";
permission java.util.PropertyPermission "java.vm.version", "read";
permission java.util.PropertyPermission "java.vm.vendor", "read";
permission java.util.PropertyPermission "java.vm.name", "read";
};
编程精选网(www.codehuber.com),程序员的终身学习网站已上线!
如果这篇【文章】有帮助到你,希望可以给【JavaGPT】点个赞👍,创作不易,如果有对【后端技术】、【前端领域】感兴趣的小可爱,也欢迎关注❤️❤️❤️ 【JavaGPT】❤️❤️❤️,我将会给你带来巨大的【收获与惊喜】💝💝💝!
本文由博客一文多发平台 OpenWrite 发布!