java - ElasticSearch in a runnable jar: lucene problems -


i trying create fat executable jar maven, including elasticsearch dependency create transportclient running elasticsearch node. eclipse client connects fine node, when create jar whole project , run java -jar bla.jar, connection fails with:

debug - [armor] adding address [{#transport#-1}{127.0.0.1}{127.0.0.1:9300}] debug - [armor] connected node [{#transport#-1}{127.0.0.1}{127.0.0.1:9300}] info  - [armor] failed node info {#transport#-1}{127.0.0.1}{127.0.0.1:9300}, disconnecting...  org.elasticsearch.transport.remotetransportexception: [failed deserialize response of type [org.elasticsearch.action.admin.cluster.node.liveness.livenessresponse]] caused by: org.elasticsearch.transport.transportserializationexception: failed deserialize response of type [org.elasticsearch.action.admin.cluster.node.liveness.livenessresponse]   @ org.elasticsearch.transport.netty.messagechannelhandler.handleresponse(messagechannelhandler.java:179) ~[cmd-0.0.1-snapshot.jar:?]   @ org.elasticsearch.transport.netty.messagechannelhandler.messagereceived(messagechannelhandler.java:138) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.simplechannelupstreamhandler.handleupstream(simplechannelupstreamhandler.java:70) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.defaultchannelpipeline.sendupstream(defaultchannelpipeline.java:564) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.defaultchannelpipeline$defaultchannelhandlercontext.sendupstream(defaultchannelpipeline.java:791) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.channels.firemessagereceived(channels.java:296) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.handler.codec.frame.framedecoder.unfoldandfiremessagereceived(framedecoder.java:462) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.handler.codec.frame.framedecoder.calldecode(framedecoder.java:443) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.handler.codec.frame.framedecoder.messagereceived(framedecoder.java:303) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.simplechannelupstreamhandler.handleupstream(simplechannelupstreamhandler.java:70) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.defaultchannelpipeline.sendupstream(defaultchannelpipeline.java:564) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.defaultchannelpipeline.sendupstream(defaultchannelpipeline.java:559) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.channels.firemessagereceived(channels.java:268) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.channels.firemessagereceived(channels.java:255) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.socket.nio.nioworker.read(nioworker.java:88) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.socket.nio.abstractnioworker.process(abstractnioworker.java:108) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.socket.nio.abstractnioselector.run(abstractnioselector.java:337) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.socket.nio.abstractnioworker.run(abstractnioworker.java:89) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.socket.nio.nioworker.run(nioworker.java:178) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.util.threadrenamingrunnable.run(threadrenamingrunnable.java:108) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.util.internal.deadlockproofworker$1.run(deadlockproofworker.java:42) ~[cmd-0.0.1-snapshot.jar:?]   @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) ~[?:1.8.0_66-internal]   @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) ~[?:1.8.0_66-internal]   @ java.lang.thread.run(thread.java:745) ~[?:1.8.0_66-internal] ... caused by: java.lang.illegalargumentexception: spi class of type org.apache.lucene.codecs.postingsformat name 'lucene50' not exist.  need add corresponding jar file supporting spi classpath.  current     classpath supports following names: [es090, completion090, xbloomfilter]   @ org.apache.lucene.util.namedspiloader.lookup(namedspiloader.java:109) ~[cmd-0.0.1-snapshot.jar:?]   @ org.apache.lucene.codecs.postingsformat.forname(postingsformat.java:112) ~[cmd-0.0.1-snapshot.jar:?]   @ org.elasticsearch.common.lucene.lucene.<clinit>(lucene.java:68) ~[cmd-0.0.1-snapshot.jar:?]   @ org.elasticsearch.version.fromid(version.java:508) ~[cmd-0.0.1-snapshot.jar:?]   @ org.elasticsearch.version.readversion(version.java:280) ~[cmd-0.0.1-snapshot.jar:?]   @ org.elasticsearch.cluster.node.discoverynode.readfrom(discoverynode.java:327) ~[cmd-0.0.1-snapshot.jar:?]   @ org.elasticsearch.cluster.node.discoverynode.readnode(discoverynode.java:310) ~[cmd-0.0.1-snapshot.jar:?]   @ org.elasticsearch.action.admin.cluster.node.liveness.livenessresponse.readfrom(livenessresponse.java:52) ~[cmd-0.0.1-snapshot.jar:?]   @ org.elasticsearch.transport.netty.messagechannelhandler.handleresponse(messagechannelhandler.java:177) ~[cmd-0.0.1-snapshot.jar:?]   @ org.elasticsearch.transport.netty.messagechannelhandler.messagereceived(messagechannelhandler.java:138) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.simplechannelupstreamhandler.handleupstream(simplechannelupstreamhandler.java:70) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.defaultchannelpipeline.sendupstream(defaultchannelpipeline.java:564) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.defaultchannelpipeline$defaultchannelhandlercontext.sendupstream(defaultchannelpipeline.java:791) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.channels.firemessagereceived(channels.java:296) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.handler.codec.frame.framedecoder.unfoldandfiremessagereceived(framedecoder.java:462) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.handler.codec.frame.framedecoder.calldecode(framedecoder.java:443) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.handler.codec.frame.framedecoder.messagereceived(framedecoder.java:303) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.simplechannelupstreamhandler.handleupstream(simplechannelupstreamhandler.java:70) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.defaultchannelpipeline.sendupstream(defaultchannelpipeline.java:564) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.defaultchannelpipeline.sendupstream(defaultchannelpipeline.java:559) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.channels.firemessagereceived(channels.java:268) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.channels.firemessagereceived(channels.java:255) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.socket.nio.nioworker.read(nioworker.java:88) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.socket.nio.abstractnioworker.process(abstractnioworker.java:108) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.socket.nio.abstractnioselector.run(abstractnioselector.java:337) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.socket.nio.abstractnioworker.run(abstractnioworker.java:89) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.channel.socket.nio.nioworker.run(nioworker.java:178) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.util.threadrenamingrunnable.run(threadrenamingrunnable.java:108) ~[cmd-0.0.1-snapshot.jar:?]   @ org.jboss.netty.util.internal.deadlockproofworker$1.run(deadlockproofworker.java:42) ~[cmd-0.0.1-snapshot.jar:?]   @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) ~[?:1.8.0_66-internal]   @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) ~[?:1.8.0_66-internal]   @ java.lang.thread.run(thread.java:745) ~[?:1.8.0_66-internal] 

with root cause of an spi class of type org.apache.lucene.codecs.postingsformat name 'lucene50' not exist. need add corresponding jar file supporting spi classpath. current classpath supports following names: [es090, completion090, xbloomfilter]. read on this, means final jar includes same-named manifest files various lucene dependencies, overwritten each other. used maven-shade-plugin manifest resource transformer solve problem, error remains:

<build>     <plugins>         <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-shade-plugin</artifactid>             <version>2.4.3</version>             <executions>                 <execution>                     <phase>package</phase>                     <goals>                         <goal>shade</goal>                     </goals>                     <configuration>                         <transformers>                             <transformer                                 implementation="org.apache.maven.plugins.shade.resource.manifestresourcetransformer">                                 <mainclass>de.test.cmd.main</mainclass>                             </transformer>                         </transformers>                     </configuration>                 </execution>             </executions>         </plugin>     </plugins> </build> 

then looked elasticsearch jars without lucene dependency, want create transportclient communication. no such luck, there 1 jar, including lucene. can put elasticsearch runnable jar? or should keep dependencies in lib folder besides jar? don't know how tell maven that

--

update: when use "copy required libraries sub-folder besides jar" eclipse export dialog, works. let eclipse generate build.xml that, still want try , use maven building jar, either dependencies included, or directory.

you should add follow transformer tag shade plugin.

<transformer implementation="org.apache.maven.plugins.shade.resource.servicesresourcetransformer"/>


Comments

Popular posts from this blog

ios - UITEXTFIELD InputView Uipicker not working in swift -

Hatching array of circles in AutoCAD using c# -