运行嵌入式ElasticSearch时权限被拒绝异常

时间:2019-05-20 09:24:08

标签: java elasticsearch

我正在使用https://github.com/allegro/embedded-elasticsearch编写Elastic的集成测试。初始设置后,当我运行测试时,此插件成功下载了弹性实例,但开始出现权限被拒绝的错误。

我的Java版本:

openjdk 11.0.2 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

完整堆栈跟踪

Exception in thread "EmbeddedElsHandler" pl.allegro.tech.embeddedelasticsearch.EmbeddedElasticsearchStartupException: java.io.IOException: Cannot run program "/var/folders/ql/403xvvqs42v00xlnqgr6d8540000gn/T/embedded-elasticsearch-temp-dir/elasticsearch-6.6.0/bin/elasticsearch": error=13, Permission denied
    at pl.allegro.tech.embeddedelasticsearch.ElasticServer.lambda$startElasticProcess$6(ElasticServer.java:89)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.io.IOException: Cannot run program "/var/folders/ql/403xvvqs42v00xlnqgr6d8540000gn/T/embedded-elasticsearch-temp-dir/elasticsearch-6.6.0/bin/elasticsearch": error=13, Permission denied
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
    at pl.allegro.tech.embeddedelasticsearch.ElasticServer.lambda$startElasticProcess$6(ElasticServer.java:80)
    ... 1 more
Caused by: java.io.IOException: error=13, Permission denied
    at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
    at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
    at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
    ... 3 more

我的嵌入式弹性配置

@BeforeClass
public static void setup() {
 final EmbeddedElastic embeddedElastic = EmbeddedElastic.builder()
 .withElasticVersion("6.6.0")
 .withSetting(PopularProperties.TRANSPORT_TCP_PORT, "9200")
 .withSetting(PopularProperties.CLUSTER_NAME, "partner_portal_elasticsearch_cluster")
 .withPlugin("analysis-stempel") // Commented this line, with this line permission deined came while installing the plugin
  .build();

     try {
         embeddedElastic.start();
        System.out.println("Embedded Elastic Search instance started................");
     } catch (IOException e) {
         e.printStackTrace();
     } catch (InterruptedException e) {
        e.printStackTrace();
     }
  }

ElasticSearch bin文件夹如下所示(供参考) enter image description here

0 个答案:

没有答案