使用Java 11启动弹性搜索5.0.1时出现AccessControlException

时间:2019-01-02 13:42:02

标签: java elasticsearch elastic-stack elasticsearch-5 java-11

当使用Java 11从弹性搜索5.0.1到NFS分区存储索引时,出现异常。

弹性搜索日志中的Stacktrace:

java.security.AccessControlException: access denied ("java.io.FilePermission" "/globalSearchElkData/nodes/0" "write")
        at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) ~[?:?]
        at java.base/java.security.AccessController.checkPermission(AccessController.java:895) ~[?:?]
        at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:322) ~[?:?]
        at java.base/java.lang.SecurityManager.checkWrite(SecurityManager.java:752) ~[?:?]
        at java.base/sun.nio.fs.UnixPath.checkWrite(UnixPath.java:824) ~[?:?]
        at java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:377) ~[?:?]
        at java.base/java.nio.file.Files.createDirectory(Files.java:689) ~[?:?]
        at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:796) ~[?:?]
        at java.base/java.nio.file.Files.createDirectories(Files.java:742) ~[?:?]
        at org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:92) ~[lucene-core-6.2.1.jar:6.2.1 43ab70147eb494324a1410f7a9f16a896a59bc6f - shalin - 2016-09-15 05:15:20]
        at org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:41) ~[lucene-core-6.2.1.jar:6.2.1 43ab70147eb494324a1410f7a9f16a896a59bc6f - shalin - 2016-09-15 05:15:20]
        at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:45) ~[lucene-core-6.2.1.jar:6.2.1 43ab70147eb494324a1410f7a9f16a896a59bc6f - shalin - 2016-09-15 05:15:20]
        at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:225) ~[elasticsearch-5.0.1.jar:5.0.1]
        at org.elasticsearch.node.Node.<init>(Node.java:240) ~[elasticsearch-5.0.1.jar:5.0.1]
        at org.elasticsearch.node.Node.<init>(Node.java:220) ~[elasticsearch-5.0.1.jar:5.0.1]
        at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:191) ~[elasticsearch-5.0.1.jar:5.0.1]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:191) ~[elasticsearch-5.0.1.jar:5.0.1]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286) [elasticsearch-5.0.1.jar:5.0.1]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112) [elasticsearch-5.0.1.jar:5.0.1]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103) [elasticsearch-5.0.1.jar:5.0.1]
        at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54) [elasticsearch-5.0.1.jar:5.0.1]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96) [elasticsearch-5.0.1.jar:5.0.1]
        at org.elasticsearch.cli.Command.main(Command.java:62) [elasticsearch-5.0.1.jar:5.0.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) [elasticsearch-5.0.1.jar:5.0.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73) [elasticsearch-5.0.1.jar:5.0.1]
[2018-12-28T10:50:38,107][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]

注意:相同的设置可以在Java8上正常工作

1 个答案:

答案 0 :(得分:0)

要回答有关Java版本的问题:

this thread中的讨论是说6.x版将支持Java 11。

Here是当前支持的Java版本的概述。 6.5.x版支持Java 11。

异常是由弹性过程引起的,该过程很容易导致该异常过程对异常消息中的文件系统文件夹没有写权限:

<input id='search' type='search'><input type='button' value='search'>

<article id='content'>
  <p>Murphy, Kelly, O’Sullivan, Walsh, Smith, O’Brien, Byrne, Ryan, O’Connor, O’Neill, O’Reilly, Doyle, McCarthy, Gallagher, O’Doherty, Kennedy, Lynch, Murray, Quinn, Moore, McLoughlin, O’Carroll, Connolly, Daly, O’Connell, Wilson, Dunne, Brennan, Burke, Collins, Campbell, Clarke, Johnston, Hughes, O’Farrell, Fitzgerald, Brown, Martin, Maguire, Nolan, Flynn, Thompson, O’Callaghan, O’Donnell, Duffy, O’Mahony, Boyle, Healy, O’Shea, White, Sweeney, Hayes, Kavanagh, Power, McGrath, Moran, Brady, Stewart, Casey, Foley, Fitzpatrick, O’Leary, McDonnell, MacMahon, Donnelly, Regan, Donovan, Burns, Flanagan, Mullan, Barry, Kane, Robinson, Cunningham, Griffin, Kenny, Sheehan, Ward, Whelan, Lyons, Reid, Graham, Higgins, Cullen, Keane, King, Maher, MacKenna, Bell, Scott, Hogan, O’Keeffe, Magee, MacNamara, MacDonald, MacDermott, Molony, O’Rourke, Buckley, O’Dwyer</p>
</article>

请检查文件夹 / globalSearchElkData / nodes / 0

的权限