On 4/8/2016 7:51 AM, Rohana Rajapakse wrote:
> Thanks. I know it exists, but don't know how to use it.
>
> I am trying to use EmbeddedSolrServer(Path solrHome, String defaultCoreName)
>
> What should be the "solrHome"? Should it be the actual solr home (i.e.
> lucene-solr-master\solr\server\solr) in the solr server, or can it be any
> temporary folder?
>
> I create it with: new EmbeddedSolrServer((new
> File("testdata/solr")).toPath(), "tmpcore"); and get the following Exception
> (I use solr-Solr-7.0.0):
>
> org.apache.solr.common.SolrException: Should not have found solr/@persistent
> . Please upgrade your solr.xml:
> https://cwiki.apache.org/confluence/display/solr/Format+of+solr.xml
> at
> org.apache.solr.core.SolrXmlConfig.failIfFound(SolrXmlConfig.java:167)
> at
> org.apache.solr.core.SolrXmlConfig.checkForIllegalConfig(SolrXmlConfig.java:149)
> at org.apache.solr.core.SolrXmlConfig.fromConfig(SolrXmlConfig.java:61)
> at
> org.apache.solr.core.SolrXmlConfig.fromInputStream(SolrXmlConfig.java:129)
> at org.apache.solr.core.SolrXmlConfig.fromFile(SolrXmlConfig.java:111)
> at
> org.apache.solr.core.SolrXmlConfig.fromSolrHome(SolrXmlConfig.java:139)
> at
> org.apache.solr.core.SolrXmlConfig.fromSolrHome(SolrXmlConfig.java:144)
> at
> org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.<init>(EmbeddedSolrServer.java:70)
> at
> com.gossinteractive.solr.DocPhraseUpdateProcessorTest.createEmbeddedSolrServer(DocPhraseUpdateProcessorTest.java:140)
> at
> com.gossinteractive.solr.DocPhraseUpdateProcessorTest.setUp(DocPhraseUpdateProcessorTest.java:98)
You said you were using EmbeddedSolrServer with 4.x, so I assumed you
knew what you were doing.
You are getting that Exception because the solr home you pointed to
contains a solr.xml file in the old solr.xml format. This format is
supported by all of 4.x, but support was dropped in 5.0. The message is
pretty clear -- it says that you need to upgrade your solr.xml, and even
points at some documentation. Here's a wiki page about the old format,
with a link to another page about the new format:
http://wiki.apache.org/solr/Solr.xml%20%28supported%20through%204.x%29
Suggestion: Rather than create a File object and convert it to a Path,
use NIO2 methods directly:
Paths.get("testdata/solr")
Thanks,
Shawn