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 Jennifer Coston <Je...@raytheon.com> on 2017/01/03 17:35:43 UTC
Can I use SolrJ 6.3.0 to talk to a Solr 5.2.3 server?
Hello,
I am running into a conflict with Solr and ElasticSearch. We are trying to add support for Elastic Search 5.1.1 which requires Lucene 6.3.0 to an existing system that uses Solr 5.2.3. At the moment I am using SolrJ 5.3.1 to talk to the 5.2.3 Server. I was hoping I could just update the SolrJ libraries to 6.3.0 so the Lucene conflict goes away, but when I try to run my unit tests I'm seeing this error:
java.util.ServiceConfigurationError: Cannot instantiate SPI class: org.apache.lucene.codecs.simpletext.SimpleTextPostingsFormat
at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:82)
at org.apache.lucene.codecs.PostingsFormat.reloadPostingsFormats(PostingsFormat.java:132)
at org.apache.solr.core.SolrResourceLoader.reloadLuceneSPI(SolrResourceLoader.java:237)
at org.apache.solr.core.SolrResourceLoader.<init>(SolrResourceLoader.java:182)
at org.apache.solr.core.SolrResourceLoader.<init>(SolrResourceLoader.java:142)
at org.apache.solr.core.CoreContainer.<init>(CoreContainer.java:217)
at com.rtn.iaf.catalog.test.SolrAnalyticClientTest.setUpBeforeClass(SolrAnalyticClientTest.java:59)
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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.IllegalAccessException: Class org.apache.lucene.util.NamedSPILoader can not access a member of class org.apache.lucene.codecs.simpletext.SimpleTextPostingsFormat with modifiers "public"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)
at java.lang.Class.newInstance(Class.java:436)
at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:72)
... 22 more
Is it possible to talk to the 5.2.3 Server using SolrJ 6.3.0?
Here are the Solr Dependencies I have in my pom.xml:
<!-- Solr dependencies -->
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>6.3.0</version>
</dependency>
<!-- Required by embedded solr server -->
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-core</artifactId>
<version>6.3.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>jdk.tools</artifactId>
<groupId>jdk.tools</groupId>
</exclusion>
<exclusion>
<artifactId>jetty-continuation</artifactId>
<groupId>org.eclipse.jetty</groupId>
</exclusion>
<exclusion>
<artifactId>jetty-deploy</artifactId>
<groupId>org.eclipse.jetty</groupId>
</exclusion>
<exclusion>
<artifactId>jetty-jmx</artifactId>
<groupId>org.eclipse.jetty</groupId>
</exclusion>
<exclusion>
<artifactId>jetty-rewrite</artifactId>
<groupId>org.eclipse.jetty</groupId>
</exclusion>
<exclusion>
<artifactId>jetty-servlets</artifactId>
<groupId>org.eclipse.jetty</groupId>
</exclusion>
<exclusion>
<artifactId>jetty-util</artifactId>
<groupId>org.eclipse.jetty</groupId>
</exclusion>
<exclusion>
<artifactId>hadoop-annotations</artifactId>
<groupId>org.apache.hadoop</groupId>
</exclusion>
<exclusion>
<artifactId>hadoop-auth</artifactId>
<groupId>org.apache.hadoop</groupId>
</exclusion>
<exclusion>
<artifactId>hadoop-common</artifactId>
<groupId>org.apache.hadoop</groupId>
</exclusion>
<exclusion>
<artifactId>hadoop-hdfs</artifactId>
<groupId>org.apache.hadoop</groupId>
</exclusion>
</exclusions>
</dependency>
Please let me know if you need any additional information.
Thank you!
- Jennifer
RE: Can I use SolrJ 6.3.0 to talk to a Solr 5.2.3 server?
Posted by Jennifer Coston <Je...@raytheon.com>.
Thanks for the responses! Shawn you are right, I'm using Solr 5.2.1 not 5.2.3. In the main code I am using the HttpSolrClient (we are calling it the SolrCatalogClient) and an EmbeddedSolrServer in the JUnit Tests that we use the SolrCatalogClient to query:
private static SolrCatalogClient testSolrClient;
private static EmbeddedSolrServer embeddedServer;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
System.setProperty("solr.solr.home", "solr/conf");
System.setProperty("solr.data.dir", new File("target/solr-embedded-data").getAbsolutePath());
CoreContainer coreContainer = new CoreContainer("solr/conf");
coreContainer.load();
CoreDescriptor cd = new CoreDescriptor(coreContainer, " ourSolrCore ", new File("solr").getAbsolutePath());
coreContainer.create(cd);
LOGGER.info("Printing all Core Names: " + coreContainer.getAllCoreNames());
embeddedServer = new EmbeddedSolrServer(coreContainer, "ourSolrCore");
LOGGER.info("Initializing Solr Client for JUnit tests");
testSolrClient = new SolrCatalogClient(embeddedServer);
//Create test objects
TestObject testObject1 = new TestObject(...);
testSolrClient.addObject(testObject1);
}
@Test
public void testIdDoesNotExistQuery() {
String json = testSolrClient.getQueryResponseAsJson("1111");
LOGGER.info("Solrj does not exist response = " + json);
assert(json.equalsIgnoreCase("[]"));
}
If I extend the SolrJettyTestBase can I still specify the schema that I want to use for the tests?
-Jennifer
-----Original Message-----
From: Shawn Heisey [mailto:apache@elyograg.org]
Sent: Tuesday, January 03, 2017 2:31 PM
To: solr-user@lucene.apache.org
Subject: Re: Can I use SolrJ 6.3.0 to talk to a Solr 5.2.3 server?
On 1/3/2017 10:35 AM, Jennifer Coston wrote:
> I am running into a conflict with Solr and ElasticSearch. We are trying to add support for Elastic Search 5.1.1 which requires Lucene 6.3.0 to an existing system that uses Solr 5.2.3. At the moment I am using SolrJ 5.3.1 to talk to the 5.2.3 Server. I was hoping I could just update the SolrJ libraries to 6.3.0 so the Lucene conflict goes away, but when I try to run my unit tests I'm seeing this error:
There is no 5.2.3 version of Solr. The 5.2.x line ended with 5.2.1.
There is a 5.3.2 version.
If you're using HttpSolrClient, mixing a 5.x server and a 6.x client will be no problem at all. If you're using CloudSolrClient you may run into issues because of the very rapid pace of change in SolrCloud -- mixing major versions is not recommended. If you're using EmbeddedSolrServer, then the client and the server are not separate, so upgrading both at once is probably OK, but the code and the core config might require changes.
> java.util.ServiceConfigurationError: Cannot instantiate SPI class:
> org.apache.lucene.codecs.simpletext.SimpleTextPostingsFormat
This is an error from a Solr *server*, not a client. Are you using EmbeddedSolrServer?
> Here are the Solr Dependencies I have in my pom.xml:
You've got a solr-core dependency here. That is not at all necessary for a SolrJ client, *unless* you are using EmbeddedSolrServer. If you are using the embedded server, then things are much more complicated, and your code may require changes before it will work correctly with a new major version. The embedded server is NOT recommended unless you have no other choice. The unit tests included with Solr are able to fire up Solr with Jetty for tests, just like a real separate Solr server. Your tests can also do this. Look for tests in the Lucene/Solr codebase that extend SolrJettyTestBase, and use those as a guide.
Thanks,
Shawn
Re: Can I use SolrJ 6.3.0 to talk to a Solr 5.2.3 server?
Posted by Shawn Heisey <ap...@elyograg.org>.
On 1/4/2017 8:29 AM, Jennifer Coston wrote:
> Can anyone explain how to get rid of this error?
>
> java.lang.Exception: Assertions mismatch: -ea was not specified but -Dtests.asserts=true
> at __randomizedtesting.SeedInfo.seed([5B25E606A72BD541]:0)
> at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:47)
> 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)
When you started your test, a system property was included (the java
commandline option for that is -Dtests.assert=true) that tells something
that you wanted assertions enabled. Looks like this message comes from
the lucene test-framework. When this property is set to true, it also
requires a java commandline option to enable assertions, which is -ea as
the message said.
You'll need to either add "-ea" to the java commandline or remove the
system property. If you didn't specify the system property and can't
figure out how to remove it, then you'll likely need help from somebody
who's really familiar with the build system. You can find those people
on the dev mailing list or the #lucene-dev IRC channel on freenode.
Some of them do hang out on this mailing list, but it's not really
on-topic for this list.
http://lucene.apache.org/core/discussion.html
If you choose the IRC channel, here's a Solr resource about IRC
channels. The channels this page mentions are specific to Solr, but the
information provided is relevant for any technical IRC channel:
https://wiki.apache.org/solr/IRCChannels
Thanks,
Shawn
RE: Can I use SolrJ 6.3.0 to talk to a Solr 5.2.3 server?
Posted by Jennifer Coston <Je...@raytheon.com>.
Can anyone explain how to get rid of this error?
java.lang.Exception: Assertions mismatch: -ea was not specified but -Dtests.asserts=true
at __randomizedtesting.SeedInfo.seed([5B25E606A72BD541]:0)
at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:47)
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)
Here is my test class:
public class SolrCatalogClientTest extends SolrJettyTestBase {
private static SolrCatalogClient solrClient;
protected static JettySolrRunner SOLR;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
System.setProperty("tests.asserts", "false");
System.setProperty("solr.solr.home", "solr/conf");
System.setProperty("solr.core.name", "mySolrCore");
System.setProperty("solr.data.dir", new File("target/solr-embedded-data").getAbsolutePath());
System.out.println("Initializing Solr for JUnit tests");
SOLR = createJetty(
"target/solr-embedded-data",
JettyConfig.builder()
.setPort(8983)
.setContext("/solr")
.stopAtShutdown(true)
.build());
solrClient = new SolrCatalogClient();
...}
}
Should I be using initCore instead of createJetty?
Thank you!
-Jennifer
-----Original Message-----
From: Shawn Heisey [mailto:apache@elyograg.org]
Sent: Tuesday, January 03, 2017 2:31 PM
To: solr-user@lucene.apache.org
Subject: Re: Can I use SolrJ 6.3.0 to talk to a Solr 5.2.3 server?
On 1/3/2017 10:35 AM, Jennifer Coston wrote:
> I am running into a conflict with Solr and ElasticSearch. We are trying to add support for Elastic Search 5.1.1 which requires Lucene 6.3.0 to an existing system that uses Solr 5.2.3. At the moment I am using SolrJ 5.3.1 to talk to the 5.2.3 Server. I was hoping I could just update the SolrJ libraries to 6.3.0 so the Lucene conflict goes away, but when I try to run my unit tests I'm seeing this error:
There is no 5.2.3 version of Solr. The 5.2.x line ended with 5.2.1.
There is a 5.3.2 version.
If you're using HttpSolrClient, mixing a 5.x server and a 6.x client will be no problem at all. If you're using CloudSolrClient you may run into issues because of the very rapid pace of change in SolrCloud -- mixing major versions is not recommended. If you're using EmbeddedSolrServer, then the client and the server are not separate, so upgrading both at once is probably OK, but the code and the core config might require changes.
> java.util.ServiceConfigurationError: Cannot instantiate SPI class:
> org.apache.lucene.codecs.simpletext.SimpleTextPostingsFormat
This is an error from a Solr *server*, not a client. Are you using EmbeddedSolrServer?
> Here are the Solr Dependencies I have in my pom.xml:
You've got a solr-core dependency here. That is not at all necessary for a SolrJ client, *unless* you are using EmbeddedSolrServer. If you are using the embedded server, then things are much more complicated, and your code may require changes before it will work correctly with a new major version. The embedded server is NOT recommended unless you have no other choice. The unit tests included with Solr are able to fire up Solr with Jetty for tests, just like a real separate Solr server. Your tests can also do this. Look for tests in the Lucene/Solr codebase that extend SolrJettyTestBase, and use those as a guide.
Thanks,
Shawn
Re: Can I use SolrJ 6.3.0 to talk to a Solr 5.2.3 server?
Posted by Shawn Heisey <ap...@elyograg.org>.
On 1/3/2017 10:35 AM, Jennifer Coston wrote:
> I am running into a conflict with Solr and ElasticSearch. We are trying to add support for Elastic Search 5.1.1 which requires Lucene 6.3.0 to an existing system that uses Solr 5.2.3. At the moment I am using SolrJ 5.3.1 to talk to the 5.2.3 Server. I was hoping I could just update the SolrJ libraries to 6.3.0 so the Lucene conflict goes away, but when I try to run my unit tests I'm seeing this error:
There is no 5.2.3 version of Solr. The 5.2.x line ended with 5.2.1.
There is a 5.3.2 version.
If you're using HttpSolrClient, mixing a 5.x server and a 6.x client
will be no problem at all. If you're using CloudSolrClient you may run
into issues because of the very rapid pace of change in SolrCloud --
mixing major versions is not recommended. If you're using
EmbeddedSolrServer, then the client and the server are not separate, so
upgrading both at once is probably OK, but the code and the core config
might require changes.
> java.util.ServiceConfigurationError: Cannot instantiate SPI class: org.apache.lucene.codecs.simpletext.SimpleTextPostingsFormat
This is an error from a Solr *server*, not a client. Are you using
EmbeddedSolrServer?
> Here are the Solr Dependencies I have in my pom.xml:
You've got a solr-core dependency here. That is not at all necessary
for a SolrJ client, *unless* you are using EmbeddedSolrServer. If you
are using the embedded server, then things are much more complicated,
and your code may require changes before it will work correctly with a
new major version. The embedded server is NOT recommended unless you
have no other choice. The unit tests included with Solr are able to
fire up Solr with Jetty for tests, just like a real separate Solr
server. Your tests can also do this. Look for tests in the Lucene/Solr
codebase that extend SolrJettyTestBase, and use those as a guide.
Thanks,
Shawn
Re: Can I use SolrJ 6.3.0 to talk to a Solr 5.2.3 server?
Posted by Furkan KAMACI <fu...@gmail.com>.
Hi Jennifer,
Take a look at index compatibility beside dependencies. Here is the
explanation:
Index Format Changes
Solr 6 has no support for reading Lucene/Solr 4.x and earlier indexes. Be
sure to run the Lucene IndexUpgrader included with Solr 5.5 if you might
still have old 4x formatted segments in your index. Alternatively: fully
optimize your index with Solr 5.5 to make sure it consists only of one
up-to-date index segment.
You can read more from here:
https://cwiki.apache.org/confluence/display/solr/Major+Changes+from+Solr+5+to+Solr+6
Kind Regards,
Furkan KAMACI
On Tue, Jan 3, 2017 at 7:35 PM, Jennifer Coston <
Jennifer.Coston@raytheon.com> wrote:
> Hello,
>
> I am running into a conflict with Solr and ElasticSearch. We are trying to
> add support for Elastic Search 5.1.1 which requires Lucene 6.3.0 to an
> existing system that uses Solr 5.2.3. At the moment I am using SolrJ 5.3.1
> to talk to the 5.2.3 Server. I was hoping I could just update the SolrJ
> libraries to 6.3.0 so the Lucene conflict goes away, but when I try to run
> my unit tests I'm seeing this error:
>
> java.util.ServiceConfigurationError: Cannot instantiate SPI class:
> org.apache.lucene.codecs.simpletext.SimpleTextPostingsFormat
> at org.apache.lucene.util.NamedSPILoader.reload(
> NamedSPILoader.java:82)
> at org.apache.lucene.codecs.PostingsFormat.
> reloadPostingsFormats(PostingsFormat.java:132)
> at org.apache.solr.core.SolrResourceLoader.
> reloadLuceneSPI(SolrResourceLoader.java:237)
> at org.apache.solr.core.SolrResourceLoader.<init>(
> SolrResourceLoader.java:182)
> at org.apache.solr.core.SolrResourceLoader.<init>(
> SolrResourceLoader.java:142)
> at org.apache.solr.core.CoreContainer.<init>(
> CoreContainer.java:217)
> at com.rtn.iaf.catalog.test.SolrAnalyticClientTest.
> setUpBeforeClass(SolrAnalyticClientTest.java:59)
> 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 org.junit.runners.model.FrameworkMethod$1.
> runReflectiveCall(FrameworkMethod.java:50)
> at org.junit.internal.runners.
> model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> at org.junit.runners.model.FrameworkMethod.
> invokeExplosively(FrameworkMethod.java:47)
> at org.junit.internal.runners.statements.RunBefores.
> evaluate(RunBefores.java:24)
> at org.junit.internal.runners.
> statements.RunAfters.evaluate(RunAfters.java:27)
> at org.junit.runners.ParentRunner.run(ParentRunner.
> java:363)
> at org.eclipse.jdt.internal.junit4.runner.
> JUnit4TestReference.run(JUnit4TestReference.java:86)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.
> run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.
> runTests(RemoteTestRunner.java:459)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.
> runTests(RemoteTestRunner.java:675)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.
> run(RemoteTestRunner.java:382)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.
> main(RemoteTestRunner.java:192)
> Caused by: java.lang.IllegalAccessException: Class org.apache.lucene.util.NamedSPILoader
> can not access a member of class org.apache.lucene.codecs.simpletext.SimpleTextPostingsFormat
> with modifiers "public"
> at sun.reflect.Reflection.ensureMemberAccess(Reflection.
> java:102)
> at java.lang.Class.newInstance(Class.java:436)
> at org.apache.lucene.util.NamedSPILoader.reload(
> NamedSPILoader.java:72)
> ... 22 more
> Is it possible to talk to the 5.2.3 Server using SolrJ 6.3.0?
>
> Here are the Solr Dependencies I have in my pom.xml:
>
> <!-- Solr dependencies -->
> <dependency>
> <groupId>org.apache.solr</groupId>
> <artifactId>solr-solrj</artifactId>
> <version>6.3.0</version>
> </dependency>
> <!-- Required by embedded solr server -->
> <dependency>
> <groupId>org.apache.solr</groupId>
> <artifactId>solr-core</artifactId>
> <version>6.3.0</version>
> <scope>test</scope>
> <exclusions>
> <exclusion>
> <artifactId>jdk.tools</artifactId>
> <groupId>jdk.tools</groupId>
> </exclusion>
> <exclusion>
> <artifactId>jetty-
> continuation</artifactId>
> <groupId>org.eclipse.jetty</groupId>
> </exclusion>
> <exclusion>
> <artifactId>jetty-deploy</artifactId>
> <groupId>org.eclipse.jetty</groupId>
> </exclusion>
> <exclusion>
> <artifactId>jetty-jmx</artifactId>
> <groupId>org.eclipse.jetty</groupId>
> </exclusion>
> <exclusion>
> <artifactId>jetty-rewrite</artifactId>
> <groupId>org.eclipse.jetty</groupId>
> </exclusion>
> <exclusion>
> <artifactId>jetty-servlets</artifactId>
> <groupId>org.eclipse.jetty</groupId>
> </exclusion>
> <exclusion>
> <artifactId>jetty-util</artifactId>
> <groupId>org.eclipse.jetty</groupId>
> </exclusion>
> <exclusion>
> <artifactId>hadoop-
> annotations</artifactId>
> <groupId>org.apache.hadoop</groupId>
> </exclusion>
> <exclusion>
> <artifactId>hadoop-auth</artifactId>
> <groupId>org.apache.hadoop</groupId>
> </exclusion>
> <exclusion>
> <artifactId>hadoop-common</artifactId>
> <groupId>org.apache.hadoop</groupId>
> </exclusion>
> <exclusion>
> <artifactId>hadoop-hdfs</artifactId>
> <groupId>org.apache.hadoop</groupId>
> </exclusion>
> </exclusions>
> </dependency>
>
> Please let me know if you need any additional information.
>
> Thank you!
> - Jennifer
>
>