Hello there,
I'm using elastic-search v6.2.3, with x-pack plugin-in v6.2.3 installed.
The deployment used RPMs and my OS is centos 7. I've conducted a recent upgrade from 5.4.0 to 5.6.8 to 6.2.3.
As part of the upgrade work I needed to upgrade my custom x-pack authentication realm which was working for 5.4.0.
In X-Pack 6.2 we made a number of changes that affect the way X-Pack is packaged, and also introduced a number of new jar dependencies.
X-Pack security does include Guava (it's a transitive dependency from other libraries that we rely on) and that prevents you from including Guava in your own extension.
What makes that harder to deal with, is the fact that Guava is not compatible between major versions, so your extension can only use Guava 19.0
If you can live with that (and it appeas that you can, since that's in your dependency tree) then just mark the dependency as "provided" in your POM (or equivalent for other build systems) and it should all work fine.
We will be making a significant change to the packaging of extensions in 6.3, so this advice is only relevant for 6.2.x
Thanks for your reply Tim.
My code uses guava 19.0 as already mentioned. However, when I set the scope to provided when elastic-search starts it complains that it cannot find a particular guava class on the class path. I'm asserting that JARs listed above (in /usr/share/elasticsearch/plugins/x-pack/x-pack-security) are not actually on the elastic-search classpath?
To workaround my JarHell issue, I temporarily moved the guava-19.0.jar, installed my custom realm x-pack plugin successfully pulling in a compile time dependency on guava-19.0.jar, and then I restored guava-19.0.jar back on the file-system (/usr/share/elasticsearch/plugins/x-pack/x-pack-security). Then when I install elastic-search everything I need is on the classpath.
Looking at the JarHell class, the checkClass method could perhaps be more sophisticated and check the version of the JAR. As long as I'm using the same version of guava I guess there should be no problems and perhaps it shouldn't throw an exception when the versions of the JARs are the same?
Anyway, with this hack I get a little further even though it still isn't working as it seems I need to adjust my security permissions:
[2018-04-10T13:01:17,684][DEBUG][o.a.h.i.n.c.PoolingNHttpClientConnectionManager] Connection request: [route: {}->http://192.168.1.168:8225][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 5]
[2018-04-10T13:01:17,704][ERROR][o.a.h.i.n.c.InternalHttpAsyncClient] I/O reactor terminated abnormally
java.security.AccessControlException: access denied ("java.net.SocketPermission" "192.168.1.168:8225" "connect,resolve")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) ~[?:1.8.0_161]
at java.security.AccessController.checkPermission(AccessController.java:884) ~[?:1.8.0_161]
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) ~[?:1.8.0_161]
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1051) ~[?:1.8.0_161]
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_161]
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.