You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Mohit Sidana <si...@gmail.com> on 2016/12/22 11:15:08 UTC
Error Loading Custom Codec class with Solr Codec Factory. Class cast exception
Hello,
I am trying to experiment with my solr indexes with the patch open on JIRA -
Codec for index-level encryption
<https://issues.apache.org/jira/browse/LUCENE-6966> (LUCENE-6966).
https://issues.apache.org/jira/browse/LUCENE-6966.
I am currently trying to test this Custom codec with Solr to encrypt
sensitive documents.
I have applied this patch to cloned Lucene-solr trunk (branch 6.3 on my
local machine) and used “ant compile” and “ant jar” to get the jar files.
By using this custom codec I can make use of the custom codec(Posting
-format) classes by overridden posting format in field type definations.
<fieldType name="string" class="solr.StrField" sortMissingLast="true"
docValues="true" *postingsFormat= "EncryptedLucene50"* />
But when I try to load this codec directly via Solrconfig.xml CodecFactory
as below.
<codecFactory
class="org.apache.lucene.codecs.encrypted.DummyEncryptedLucene60Codec"/>
Solr is not able to load the core and initialize the codec. I am getting
the following error in my logs.
java.util.concurrent.ExecutionException:
org.apache.solr.common.SolrException: Unable to create core [test]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at
org.apache.solr.core.CoreContainer.lambda$load$1(CoreContainer.java:526)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:229)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.solr.common.SolrException: Unable to create core
[test]
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:855)
at
org.apache.solr.core.CoreContainer.lambda$load$0(CoreContainer.java:498)
... 5 more
Caused by: org.apache.solr.common.SolrException: class
com.wk.codecs.encrypted.DummyEncryptedLucene60Codec
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:903)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:776)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:842)
... 6 more
Caused by: java.lang.ClassCastException: class
com.wk.codecs.encrypted.DummyEncryptedLucene60Codec
at java.lang.Class.asSubclass(Class.java:3404)
at
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:540)
at
org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:625)
at
org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:590)
at
org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:583)
at org.apache.solr.core.SolrCore.initCodec(SolrCore.java:1112)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:847)
... 8 more
I am new to solr and unable to track what is causing this error.
Is it classpath issue or something else ?
I will appreciate any feedback on this.
Thanks,
Mohit
Re: Error Loading Custom Codec class with Solr Codec Factory. Class
cast exception
Posted by Chris Hostetter <ho...@fucit.org>.
: But when I try to load this codec directly via Solrconfig.xml CodecFactory
: as below.
:
:
: <codecFactory
: class="org.apache.lucene.codecs.encrypted.DummyEncryptedLucene60Codec"/>
...there is a difference between a (lucene layer) Codec. And a (solr
layer) CodecFactory.
Having the codec code in place (with the necessary SPI metadata
files) let's Solr/Lucene *read* indexes written in that codec, but in
order to create new indexes with your codec, you have to write
a concrete implementation of the CodecFactory abstract class and provide
that *Factory* class name in your <codecFactory /> config line. There is
probably no CodecFactory for your DummyEncryptedLucene60Codec defined in
the patch you're trying out.
-Hoss
http://www.lucidworks.com/