I am using apache httpcore-nio to make an http request from my ES plugin to another application. Even after adding permission in plugin security policy file and wrapping the call with AccessController.doPrivileged in my plugin, I am getting the below error.
I/O reactor terminated abnormally
java.security.AccessControlException: access denied ("java.net.SocketPermission" "127.0.0.1:8000" "connect,resolve")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) ~[?:1.8.0_144]
at java.security.AccessController.checkPermission(AccessController.java:884) ~[?:1.8.0_144]
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) ~[?:1.8.0_144]
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1051) ~[?:1.8.0_144]
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:625) ~[?:?]
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processSessionRequests(DefaultConnectingIOReactor.java:273) ~[httpcore-nio-4.4.5.jar:4.4.5]
[2018-02-27T03:22:03,045][ERROR][o.a.h.i.n.c.InternalHttpAsyncClient] I/O reactor terminated abnormally
java.security.AccessControlException: access denied ("java.net.SocketPermission" "127.0.0.1:8000" "connect,resolve")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) ~[?:1.8.0_144]
at java.security.AccessController.checkPermission(AccessController.java:884) ~[?:1.8.0_144]
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) ~[?:1.8.0_144]
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1051) ~[?:1.8.0_144]
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:625) ~[?:?]
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processSessionRequests(DefaultConnectingIOReactor.java:273) ~[httpcore-nio-4.4.5.jar:4.4.5]
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:139) ~[httpcore-nio-4.4.5.jar:4.4.5]
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:348) ~[httpcore-nio-4.4.5.jar:4.4.5]
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:192) ~[httpasyncclient-4.1.2.jar:4.1.2]
at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64) [httpasyncclient-4.1.2.jar:4.1.2]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
code block:
httpclient.start();
final CountDownLatch latch = new CountDownLatch(1);
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws IOException {
httpclient.execute(get, new FutureCallback<HttpResponse>() {
@Override
public void completed(final HttpResponse response) {
try {
latch.countDown();
callbackResponse = response;
} catch (IllegalStateException e) {
throw new RuntimeException();
}
}
@Override
public void failed(final Exception ex) {
latch.countDown();
}
@Override
public void cancelled() {
latch.countDown();
}
});
return null;
}
});
} catch (PrivilegedActionException e) {
throw (IOException) e.getCause();
}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.