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 Joe Lawson <jl...@opensourceconnections.com> on 2016/04/11 18:29:42 UTC

Solr 6 - AbstractSolrTestCase Error Unable to build KeyStore from file: null

I'm upgrading a plugin and use the AbstractSolrTestCase for tests. My tests
work fine in 5.X but when I upgraded to 6.X the tests sometimes throw an
error during initialization. Basically it says,
"org.apache.solr.common.SolrException: Error instantiating
shardHandlerFactory class
[org.apache.solr.handler.component.HttpShardHandlerFactory]: Unable to
build KeyStore from file: null"

I don't really see any changes from 5 to 6 that cause this. Any clues? Here
is the code:
https://github.com/healthonnet/hon-lucene-synonyms/tree/solr-6.0.0

Thanks for the help,

Joe Lawson

Full Error:


NOTE: test params are: codec=Asserting(Lucene60): {}, docValues:{},
>> maxPointsInLeafNode=604, maxMBSortInHeap=5.184451165904283,
>> sim=ClassicSimilarity, locale=en, timezone=America/Blanc-Sablon
>
> NOTE: Linux 4.4.5-1-ARCH amd64/Oracle Corporation 1.8.0_77
>> (64-bit)/cpus=8,threads=1,free=215181912,total=358088704
>
> NOTE: All tests run in this JVM: [TestBaggedSynonyms,
>> TestConstructedPhrases]
>
> NOTE: reproduce with: ant test  -Dtestcase=TestConstructedPhrases
>> -Dtests.seed=48D5F3D29EAB417 -Dtests.locale=en
>> -Dtests.timezone=America/Blanc-Sablon -Dtests.asserts=true
>> -Dtests.file.encoding=UTF-8
>
>
>> org.apache.solr.common.SolrException: Error instantiating
>> shardHandlerFactory class
>> [org.apache.solr.handler.component.HttpShardHandlerFactory]: Unable to
>> build KeyStore from file: null
>
>
>> at __randomizedtesting.SeedInfo.seed([48D5F3D29EAB417]:0)
>
> at
>> org.apache.solr.handler.component.ShardHandlerFactory.newInstance(ShardHandlerFactory.java:52)
>
> at org.apache.solr.core.CoreContainer.load(CoreContainer.java:404)
>
> at org.apache.solr.util.TestHarness.<init>(TestHarness.java:164)
>
> at org.apache.solr.util.TestHarness.<init>(TestHarness.java:127)
>
> at org.apache.solr.util.TestHarness.<init>(TestHarness.java:133)
>
> at org.apache.solr.util.TestHarness.<init>(TestHarness.java:96)
>
> at org.apache.solr.SolrTestCaseJ4.createCore(SolrTestCaseJ4.java:598)
>
> at org.apache.solr.SolrTestCaseJ4.initCore(SolrTestCaseJ4.java:588)
>
> at org.apache.solr.SolrTestCaseJ4.initCore(SolrTestCaseJ4.java:430)
>
> at org.apache.solr.SolrTestCaseJ4.initCore(SolrTestCaseJ4.java:419)
>
> at
>> org.apache.solr.search.HonLuceneSynonymTestCase.beforeClass(HonLuceneSynonymTestCase.java:36)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>
> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>
> at java.lang.reflect.Method.invoke(Method.java:498)
>
> at
>> com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1764)
>
> at
>> com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:811)
>
> at
>> com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:827)
>
> at
>> com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
>
> at
>> com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule$1.evaluate(SystemPropertiesRestoreRule.java:57)
>
> at
>> org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
>
> at
>> com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
>
> at
>> org.apache.lucene.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:41)
>
> at
>> com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
>
> at
>> com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
>
> at
>> com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
>
> at
>> com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
>
> at
>> com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
>
> at
>> org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
>
> at
>> org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
>
> at
>> org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
>
> at
>> org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:54)
>
> at
>> com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
>
> at
>> com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:367)
>
> at java.lang.Thread.run(Thread.java:745)
>
>
>>

Re: Solr 6 - AbstractSolrTestCase Error Unable to build KeyStore from file: null

Posted by Joe Lawson <jl...@opensourceconnections.com>.
Adding @SolrTestCaseJ4.SuppressSSL to my abstract class extended the
AbstractSolrTestCase worked. Thanks!

https://github.com/healthonnet/hon-lucene-synonyms/blob/cedb3cbb56b01cd6480c257c04999cdce433f53e/src/test/java/org/apache/solr/search/HonLuceneSynonymTestCase.java#L21-L21

On Mon, Apr 11, 2016 at 8:45 PM, Chris Hostetter <ho...@fucit.org>
wrote:

>
> https://issues.apache.org/jira/browse/SOLR-8970
> https://issues.apache.org/jira/browse/SOLR-8971
>
> : Date: Mon, 11 Apr 2016 20:35:22 -0400
> : From: Joe Lawson <jl...@opensourceconnections.com>
> : Reply-To: solr-user@lucene.apache.org
> : To: solr-user@lucene.apache.org
> : Subject: Re: Solr 6 - AbstractSolrTestCase Error Unable to build
> KeyStore from
> :      file: null
> :
> : Thanks for the insight. I figured that it was something like that and
> : perhaps I has thread contention on a resource that wasn't really thread
> : safe.
> :
> : I'll give your suggestions a shot tomorrow.
> :
> : Regards,
> :
> : Joe Lawson
> : On Apr 11, 2016 8:24 PM, "Chris Hostetter" <ho...@fucit.org>
> wrote:
> :
> : >
> : > : I'm upgrading a plugin and use the AbstractSolrTestCase for tests. My
> : > tests
> : > : work fine in 5.X but when I upgraded to 6.X the tests sometimes
> throw an
> : > : error during initialization. Basically it says,
> : > : "org.apache.solr.common.SolrException: Error instantiating
> : > : shardHandlerFactory class
> : > : [org.apache.solr.handler.component.HttpShardHandlerFactory]: Unable
> to
> : > : build KeyStore from file: null"
> : >
> : > Ugh.  and of course there are no other details to troubleshoot that
> : > because the stupid error handling doesn't wrap the original exception
> --
> : > it just throws it away.
> : >
> : > I'm pretty sure the problem you are seeing (unfortunately manifested in
> : > a really confusing way) is that SolrTestCaseJ4 (and
> AbstractSolrTestCase
> : > which subclasses it) has randomized the use of SSL for a while, but at
> : > some point it also started randomizing the use of client auth -- but
> this
> : > randomization happens very infrequently.
> : >
> : > (for details, check out the SSLTestConfig and it's usage in
> : > SolrTestCaseJ4)
> : >
> : > The bottom line is, in order for the (randomized) clientAuth stuff to
> : > work, SolrTestCaseJ4 assumes it can find an
> : > "../etc/test/solrtest.keystore" realtive to ExternalPaths.SERVER_HOME.
> : >
> : > If you don't have that in your test setup, bad things happen.
> : >
> : > I believe the quickest way for you to resolve this failure in your own
> : > usage of AbstractSolrTestCase is to just add the @SupressSSL
> annotation to
> : > your tests -- assuming you don't care about randomly testing your
> plugin
> : > with SSL authentication (for 99.999% of solr plugins, wether solr is
> being
> : > used over http or https shouldn't matter for test purposes)
> : >
> : > If you do want to include randomized SSL testing, then you need to make
> : > sure your that when/how you run your tests, ExternalPaths.SERVER_HOME
> : > resolves to the correct place, and "../etc/test/solrtest.keystore"
> : > resolves to a real file solr can use as the keystore.
> : >
> : > I'll file some Jiras to try and improve the error handline in these
> : > situations.
> : >
> : >
> : >
> : > -Hoss
> : > http://www.lucidworks.com/
> : >
> :
>
> -Hoss
> http://www.lucidworks.com/
>

Re: Solr 6 - AbstractSolrTestCase Error Unable to build KeyStore from file: null

Posted by Chris Hostetter <ho...@fucit.org>.
https://issues.apache.org/jira/browse/SOLR-8970
https://issues.apache.org/jira/browse/SOLR-8971

: Date: Mon, 11 Apr 2016 20:35:22 -0400
: From: Joe Lawson <jl...@opensourceconnections.com>
: Reply-To: solr-user@lucene.apache.org
: To: solr-user@lucene.apache.org
: Subject: Re: Solr 6 - AbstractSolrTestCase Error Unable to build KeyStore from
:      file: null
: 
: Thanks for the insight. I figured that it was something like that and
: perhaps I has thread contention on a resource that wasn't really thread
: safe.
: 
: I'll give your suggestions a shot tomorrow.
: 
: Regards,
: 
: Joe Lawson
: On Apr 11, 2016 8:24 PM, "Chris Hostetter" <ho...@fucit.org> wrote:
: 
: >
: > : I'm upgrading a plugin and use the AbstractSolrTestCase for tests. My
: > tests
: > : work fine in 5.X but when I upgraded to 6.X the tests sometimes throw an
: > : error during initialization. Basically it says,
: > : "org.apache.solr.common.SolrException: Error instantiating
: > : shardHandlerFactory class
: > : [org.apache.solr.handler.component.HttpShardHandlerFactory]: Unable to
: > : build KeyStore from file: null"
: >
: > Ugh.  and of course there are no other details to troubleshoot that
: > because the stupid error handling doesn't wrap the original exception --
: > it just throws it away.
: >
: > I'm pretty sure the problem you are seeing (unfortunately manifested in
: > a really confusing way) is that SolrTestCaseJ4 (and AbstractSolrTestCase
: > which subclasses it) has randomized the use of SSL for a while, but at
: > some point it also started randomizing the use of client auth -- but this
: > randomization happens very infrequently.
: >
: > (for details, check out the SSLTestConfig and it's usage in
: > SolrTestCaseJ4)
: >
: > The bottom line is, in order for the (randomized) clientAuth stuff to
: > work, SolrTestCaseJ4 assumes it can find an
: > "../etc/test/solrtest.keystore" realtive to ExternalPaths.SERVER_HOME.
: >
: > If you don't have that in your test setup, bad things happen.
: >
: > I believe the quickest way for you to resolve this failure in your own
: > usage of AbstractSolrTestCase is to just add the @SupressSSL annotation to
: > your tests -- assuming you don't care about randomly testing your plugin
: > with SSL authentication (for 99.999% of solr plugins, wether solr is being
: > used over http or https shouldn't matter for test purposes)
: >
: > If you do want to include randomized SSL testing, then you need to make
: > sure your that when/how you run your tests, ExternalPaths.SERVER_HOME
: > resolves to the correct place, and "../etc/test/solrtest.keystore"
: > resolves to a real file solr can use as the keystore.
: >
: > I'll file some Jiras to try and improve the error handline in these
: > situations.
: >
: >
: >
: > -Hoss
: > http://www.lucidworks.com/
: >
: 

-Hoss
http://www.lucidworks.com/

Re: Solr 6 - AbstractSolrTestCase Error Unable to build KeyStore from file: null

Posted by Joe Lawson <jl...@opensourceconnections.com>.
Thanks for the insight. I figured that it was something like that and
perhaps I has thread contention on a resource that wasn't really thread
safe.

I'll give your suggestions a shot tomorrow.

Regards,

Joe Lawson
On Apr 11, 2016 8:24 PM, "Chris Hostetter" <ho...@fucit.org> wrote:

>
> : I'm upgrading a plugin and use the AbstractSolrTestCase for tests. My
> tests
> : work fine in 5.X but when I upgraded to 6.X the tests sometimes throw an
> : error during initialization. Basically it says,
> : "org.apache.solr.common.SolrException: Error instantiating
> : shardHandlerFactory class
> : [org.apache.solr.handler.component.HttpShardHandlerFactory]: Unable to
> : build KeyStore from file: null"
>
> Ugh.  and of course there are no other details to troubleshoot that
> because the stupid error handling doesn't wrap the original exception --
> it just throws it away.
>
> I'm pretty sure the problem you are seeing (unfortunately manifested in
> a really confusing way) is that SolrTestCaseJ4 (and AbstractSolrTestCase
> which subclasses it) has randomized the use of SSL for a while, but at
> some point it also started randomizing the use of client auth -- but this
> randomization happens very infrequently.
>
> (for details, check out the SSLTestConfig and it's usage in
> SolrTestCaseJ4)
>
> The bottom line is, in order for the (randomized) clientAuth stuff to
> work, SolrTestCaseJ4 assumes it can find an
> "../etc/test/solrtest.keystore" realtive to ExternalPaths.SERVER_HOME.
>
> If you don't have that in your test setup, bad things happen.
>
> I believe the quickest way for you to resolve this failure in your own
> usage of AbstractSolrTestCase is to just add the @SupressSSL annotation to
> your tests -- assuming you don't care about randomly testing your plugin
> with SSL authentication (for 99.999% of solr plugins, wether solr is being
> used over http or https shouldn't matter for test purposes)
>
> If you do want to include randomized SSL testing, then you need to make
> sure your that when/how you run your tests, ExternalPaths.SERVER_HOME
> resolves to the correct place, and "../etc/test/solrtest.keystore"
> resolves to a real file solr can use as the keystore.
>
> I'll file some Jiras to try and improve the error handline in these
> situations.
>
>
>
> -Hoss
> http://www.lucidworks.com/
>

Re: Solr 6 - AbstractSolrTestCase Error Unable to build KeyStore from file: null

Posted by Chris Hostetter <ho...@fucit.org>.
: I'm upgrading a plugin and use the AbstractSolrTestCase for tests. My tests
: work fine in 5.X but when I upgraded to 6.X the tests sometimes throw an
: error during initialization. Basically it says,
: "org.apache.solr.common.SolrException: Error instantiating
: shardHandlerFactory class
: [org.apache.solr.handler.component.HttpShardHandlerFactory]: Unable to
: build KeyStore from file: null"

Ugh.  and of course there are no other details to troubleshoot that 
because the stupid error handling doesn't wrap the original exception -- 
it just throws it away.

I'm pretty sure the problem you are seeing (unfortunately manifested in 
a really confusing way) is that SolrTestCaseJ4 (and AbstractSolrTestCase 
which subclasses it) has randomized the use of SSL for a while, but at 
some point it also started randomizing the use of client auth -- but this 
randomization happens very infrequently.

(for details, check out the SSLTestConfig and it's usage in 
SolrTestCaseJ4)

The bottom line is, in order for the (randomized) clientAuth stuff to 
work, SolrTestCaseJ4 assumes it can find an 
"../etc/test/solrtest.keystore" realtive to ExternalPaths.SERVER_HOME.

If you don't have that in your test setup, bad things happen.

I believe the quickest way for you to resolve this failure in your own 
usage of AbstractSolrTestCase is to just add the @SupressSSL annotation to 
your tests -- assuming you don't care about randomly testing your plugin 
with SSL authentication (for 99.999% of solr plugins, wether solr is being 
used over http or https shouldn't matter for test purposes)

If you do want to include randomized SSL testing, then you need to make 
sure your that when/how you run your tests, ExternalPaths.SERVER_HOME 
resolves to the correct place, and "../etc/test/solrtest.keystore" 
resolves to a real file solr can use as the keystore.

I'll file some Jiras to try and improve the error handline in these 
situations.



-Hoss
http://www.lucidworks.com/