java - What causes err ' A SPI class of type lucene.codecs.Codec name 'Lucene42' -
can't figure out causing ' spi class of type org.apache.lucene.codecs.codec name 'lucene42' not exist. need add corresponding jar file supporting spi classpath'
any appreciated
java.lang.illegalargumentexception: spi class of type org.apache.lucene.codecs.codec name 'lucene42' not exist. need add corresponding jar file supporting spi classpath.the current classpath supports following names: [] org.apache.lucene.util.namedspiloader.lookup(namedspiloader.java:104) org.apache.lucene.codecs.codec.forname(codec.java:95) org.apache.lucene.codecs.codec.<clinit>(codec.java:122) org.apache.lucene.index.liveindexwriterconfig.<init>(liveindexwriterconfig.java:118) org.apache.lucene.index.indexwriterconfig.<init>(indexwriterconfig.java:145) com.damn.fr.rr.rent.getresukt(man.java:404) com.damn.fr.rr.handler.pg.setresult(pg.java:103) com.damn.fr.rr.cmd.del.execute(del.java:19) com.damn.fr.rr.servlet.publiccontroller.dopost(controller.java:199) javax.servlet.http.httpservlet.service(httpservlet.java:754) javax.servlet.http.httpservlet.service(httpservlet.java:847)
jboss deployment folder path 'c:\jbas\modules\org\apache\lucene\main' , directory contents
jboss-deployment-structure.xml
<sub-deployment name="damn.jar"> <dependencies> <module name="org.apache.commons.fileupload" /> <module name="org.apache.commons.io" /> <module name="org.apache.commons.lang3" /> <module name="org.apache.commons.validator" /> <module name="org.apache.lucene" /> <module name="net.sf.jasperreports" /> <module name="com.google.gson" /> </dependencies> </sub-deployment>
module.xml
<module xmlns="urn:jboss:module:1.0" name="org.apache.lucene"> <resources> <resource-root path="lucene-analyzers-common-4.2.0.jar"/> <resource-root path="lucene-core-4.2.0.jar"/> <resource-root path="lucene-queryparser-4.2.0.jar"/> <resource-root path="lucene-codecs-4.2.0.jar"/> </resources> <dependencies> </dependencies>
ant build file segment
<pathelement path="${thirdpartydir}/lucene-analyzers-common-4.2.0.jar" /> <pathelement path="${thirdpartydir}/lucene-codecs-4.2.0.jar" /> <pathelement path="${thirdpartydir}/lucene-queryparser- 4.2.0.jar" /> <pathelement path="${thirdpartydir}/lucene-core-4.2-snapshot.jar" />
i find this. hope there helpful though use lucene 4.10.2.
the codecs configured in 'org.apache.lucene.codecs.codec'. looked 'lucene-core-4.10.2.jar' , there such file 'meta-inf\services\org.apache.lucene.codecs.codec'. can put class name configuration file , lucene find it. however, don't need extract jar file, add , re-package jar. create new file same directory structure, is, 'meta-inf\services\org.apache.lucene.codecs.codec' java's classpath, e.g., 'target/classes' directory, , java find codec configuration file , load them.