橡皮、老虎皮、狮子皮哪一个最不好?

idea运行es7.13.2报Unknown codebases异常

Elasticsearch | 作者 Adorkable | 发布于2021年06月23日 | 阅读数:2149

idea配置:

企业微信截图_20210623164223.png

 错误信息:

企业微信截图_20210623164405.png


Available codebases: [codebase.jna-5.7.0-1.jar, codebase.lucene-grouping, codebase.t-digest-3.2.jar, codebase.joda-time, codebase.lucene-sandbox-8.8.2.jar, codebase.lucene-backward-codecs, codebase.joda-time-2.10.10.jar, codebase.lucene-highlighter, codebase.lucene-analyzers-common-8.8.2.jar, codebase.log4j-api-2.11.1.jar, codebase.lucene-memory, codebase.jopt-simple, codebase.jts-core, codebase.hppc, codebase.lucene-spatial3d-8.8.2.jar, codebase.jna, codebase.hppc-0.8.1.jar, codebase.spatial4j-0.7.jar, codebase.lucene-join, codebase.log4j-api, codebase.lucene-spatial-extras-8.8.2.jar, codebase.lucene-backward-codecs-8.8.2.jar, codebase.HdrHistogram, codebase.jackson-dataformat-cbor, codebase.lucene-highlighter-8.8.2.jar, codebase.lucene-core, codebase.spatial4j, codebase.log4j-core-2.11.1.jar, codebase.snakeyaml-1.26.jar, codebase.snakeyaml, codebase.jackson-dataformat-yaml-2.10.4.jar, codebase.HdrHistogram-2.1.9.jar, codebase.lucene-queryparser-8.8.2.jar, codebase.t-digest, codebase.lucene-memory-8.8.2.jar, codebase.lucene-analyzers-common, codebase.lucene-suggest-8.8.2.jar, codebase.jackson-dataformat-cbor-2.10.4.jar, codebase.lucene-join-8.8.2.jar, codebase.lucene-spatial-extras, codebase.lucene-queryparser, codebase.jts-core-1.15.0.jar, codebase.lucene-grouping-8.8.2.jar, codebase.jackson-core-2.10.4.jar, codebase.jackson-dataformat-yaml, codebase.jackson-core, codebase.log4j-core, codebase.lucene-queries, codebase.lucene-sandbox, codebase.lucene-misc-8.8.2.jar, codebase.lucene-suggest, codebase.idea_rt.jar, codebase.lucene-queries-8.8.2.jar, codebase.jackson-dataformat-smile, codebase.jopt-simple-5.0.2.jar, codebase.lucene-core-8.8.2.jar, codebase.lucene-misc, codebase.lucene-spatial3d, codebase.jackson-dataformat-smile-2.10.4.jar]
at org.elasticsearch.bootstrap.PolicyUtil.readPolicy(PolicyUtil.java:267) ~[classes/:?]
at org.elasticsearch.bootstrap.ESPolicy.<init>(ESPolicy.java:44) ~[classes/:?]
at org.elasticsearch.bootstrap.Security.configure(Security.java:105) ~[classes/:?]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[classes/:?]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:397) ~[classes/:?]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[classes/:?]
... 6 more
已邀请:

spoofer

赞同来自: xiaowuge bbblll

1、修改src/main/resources/org/elasticsearch/bootstrap的security.policy文件,报报错的codebase.elasticsearch-secure-sm、codebase.elasticsearch、codebase.elasticsearch-plugin-classloader三个grant codeBase配置删掉
2、新建一个policy文件,内容为:
 
grant {
permission javax.management.MBeanTruxtPermission "register";
permission javax.management.MBeanServerPermission "createMBeanServer";
permission java.lang.RuntimePermission "createClassLoader";
permission java.lang.RuntimePermission "getClassLoader";
permission java.lang.RuntimePermission "setContextClassLoader";
};

 启动的VM参数中指定这个policy文件:
-Djava.security.policy=your_path/elasticsearch.policy
3、elasticsearch.yml 文件中配置:
xpack.ml.enabled: false
然后启动~
我的版本为7.13.0


 

Charele

赞同来自:

Idea里面直接跑ES? 为什么要这么做呢?

Adorkable

赞同来自:

Caused by: java.lang.IllegalArgumentException: Unknown codebases [codebase.elasticsearch-plugin-classloader, codebase.elasticsearch, codebase.elasticsearch-secure-sm] in policy file [file:/D:/ES-Dev/elasticsearch-7.13.2/server/out/production/resources/org/elasticsearch/bootstrap/security.policy]
 
主要就是缺少elasticsearch-plugin-classloader.jar elasticsearch.jar elasticsearch-secure-sm.jar 这几个jar
 

QQ截图20210623221825.png

 
但是libs里有这些模块,
QQ截图20210623221914.png

 
server也引入了。   不知道为什么就是不行
 
 

Adorkable

赞同来自:

QQ图片20210623230230.png

检测的时候传过来的路径是idea 生成的class文件。但是es需要jar包。。。怎么才能以jar包引入这几个模块呢。。。

Charele

赞同来自:

是的,可能是你这个方法传过来的参数codebases,里面不全,
所以在
Policy policy = Policy.getInstance("JavaPolicy", new URIParameter(policyFile.toURI()));
生成这个策略的时候,
会把没注册过的(就是codebases里面没有的)加入unknownCodebases,所以报错。
 
你可以把那条抛异常的代码注消掉看看啊。
反正需要的类都有,只是不要这个检查而已。

要回复问题请先登录注册