A strange RemoteSolrException
Hello, I'm writing my first little Solrj program, but don't get it running because of an RemoteSolrException: Server at http://localhost:8983/solr returned non ok status:404 The server is definitely running and the url works in the browser. I am working with Solr 4.3.0. This is my source code: public static void main(String[] args) { String url = "http://localhost:8983/solr";; SolrServer server; try { server = new HttpSolrServer(url); server.ping(); } catch (Exception ex) { ex.printStackTrace(); } } with the stack trace: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Server at http://localhost:8983/solr returned non ok status:404, message:Not Found at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:372) at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180) at org.apache.solr.client.solrj.request.SolrPing.process(SolrPing.java:62) at org.apache.solr.client.solrj.SolrServer.ping(SolrServer.java:293) at de.epublius.blogindexer.App.main(App.java:47) If I call server.shutdown(), there is no such exception, but for almost all other SolrServer-methods. What am I doing wrong? Thanks in advance Hans-Peter
Re: A strange RemoteSolrException
Yes, I started it up with java -Dsolr.solr.home=example-DIH/solr -jar start.jar. Without the java options I don't get the expections neither! (I should have checked.) What now? -- From: "Shalin Shekhar Mangar" Sent: Monday, May 27, 2013 3:58 PM To: Subject: Re: A strange RemoteSolrException I downloaded solr 4.3.0, started it up with java -jar start.jar (from inside the example directory) and executed your program. No exceptions are thrown. Is there something you did differently? On Mon, May 27, 2013 at 5:45 PM, Hans-Peter Stricker wrote: Hello, I'm writing my first little Solrj program, but don't get it running because of an RemoteSolrException: Server at http://localhost:8983/solrreturned non ok status:404 The server is definitely running and the url works in the browser. I am working with Solr 4.3.0. This is my source code: public static void main(String[] args) { String url = "http://localhost:8983/solr";; SolrServer server; try { server = new HttpSolrServer(url); server.ping(); } catch (Exception ex) { ex.printStackTrace(); } } with the stack trace: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Server at http://localhost:8983/solr returned non ok status:404, message:Not Found at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:372) at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180) at org.apache.solr.client.solrj.request.SolrPing.process(SolrPing.java:62) at org.apache.solr.client.solrj.SolrServer.ping(SolrServer.java:293) at de.epublius.blogindexer.App.main(App.java:47) If I call server.shutdown(), there is no such exception, but for almost all other SolrServer-methods. What am I doing wrong? Thanks in advance Hans-Peter -- Regards, Shalin Shekhar Mangar.
Re: A strange RemoteSolrException
Dear Shawn, dear Shalin, thanks for your valuable replies! Could/should I have known better (by reading more carefully the manual)? I'll try to fix it - and I am confident that it will work! Best regards Hans -- From: "Shawn Heisey" Sent: Monday, May 27, 2013 4:29 PM To: Subject: Re: A strange RemoteSolrException On 5/27/2013 8:24 AM, Hans-Peter Stricker wrote: Yes, I started it up with java -Dsolr.solr.home=example-DIH/solr -jar start.jar. That explains it. See my other reply. The solr.xml file for example-DIH does not have a defaultCoreName attribute. Thanks, Shawn
Problems with DIH in Solrj
I start the SOLR example with java -Dsolr.solr.home=example-DIH/solr -jar start.jar and run public static void main(String[] args) { String url = "http://localhost:8983/solr/rss";; SolrServer server; SolrQuery query; try { server = new HttpSolrServer(url); query = new SolrQuery(); query.setParam(CommonParams.QT,"/dataimport"); QueryRequest request = new QueryRequest(query); QueryResponse response = request.process(server); server.commit(); System.out.println(response.toString()); } catch (Exception ex) { ex.printStackTrace(); } } without exception and the response string as {responseHeader={status=0,QTime=0},initArgs={defaults={config=rss-data-config.xml}},status=idle,importResponse=,statusMessages={},WARNING=This response format is experimental. It is likely to change in the future.} The Lucene index is "touched" but not really updated: there are only segments.gen and segments_a files of size 1Kb. If I execute /dataimport (full-import with option "commit" checked) from http://localhost:8983/solr/#/rss/dataimport//dataimport I get { "responseHeader": { "status": 0, "QTime": 1 }, "initArgs": [ "defaults", [ "config", "rss-data-config.xml" ] ], "command": "status", "status": "idle", "importResponse": "", "statusMessages": { "Total Requests made to DataSource": "1", "Total Rows Fetched": "10", "Total Documents Skipped": "0", "Full Dump Started": "2013-05-27 17:57:07", "": "Indexing completed. Added/Updated: 10 documents. Deleted 0 documents.", "Committed": "2013-05-27 17:57:07", "Total Documents Processed": "10", "Time taken": "0:0:0.603" }, "WARNING": "This response format is experimental. It is likely to change in the future." } What am I doing wrong?
Re: Problems with DIH in Solrj
Marvelous!! Once again: where could/should I have read this? What kinds of concepts/keywords are "command" and "full-import"? (Couldn't find them in any config file. Where are they explained?) Anyway: Now it works like a charm! Thanks Hans -- From: "Shalin Shekhar Mangar" Sent: Monday, May 27, 2013 6:09 PM To: Subject: Re: Problems with DIH in Solrj Your program is not specifying a command. You need to add: query.setParam("command", "full-import"); On Mon, May 27, 2013 at 9:31 PM, Hans-Peter Stricker wrote: I start the SOLR example with java -Dsolr.solr.home=example-DIH/solr -jar start.jar and run public static void main(String[] args) { String url = "http://localhost:8983/solr/rss";; SolrServer server; SolrQuery query; try { server = new HttpSolrServer(url); query = new SolrQuery(); query.setParam(CommonParams.QT,"/dataimport"); QueryRequest request = new QueryRequest(query); QueryResponse response = request.process(server); server.commit(); System.out.println(response.toString()); } catch (Exception ex) { ex.printStackTrace(); } } without exception and the response string as {responseHeader={status=0,QTime=0},initArgs={defaults={config=rss-data-config.xml}},status=idle,importResponse=,statusMessages={},WARNING=This response format is experimental. It is likely to change in the future.} The Lucene index is "touched" but not really updated: there are only segments.gen and segments_a files of size 1Kb. If I execute /dataimport (full-import with option "commit" checked) from http://localhost:8983/solr/#/rss/dataimport//dataimport I get { "responseHeader": { "status": 0, "QTime": 1 }, "initArgs": [ "defaults", [ "config", "rss-data-config.xml" ] ], "command": "status", "status": "idle", "importResponse": "", "statusMessages": { "Total Requests made to DataSource": "1", "Total Rows Fetched": "10", "Total Documents Skipped": "0", "Full Dump Started": "2013-05-27 17:57:07", "": "Indexing completed. Added/Updated: 10 documents. Deleted 0 documents.", "Committed": "2013-05-27 17:57:07", "Total Documents Processed": "10", "Time taken": "0:0:0.603" }, "WARNING": "This response format is experimental. It is likely to change in the future." } What am I doing wrong? -- Regards, Shalin Shekhar Mangar.
Problem with xpath expression in data-config.xml
Replacing the contents of solr-4.3.0\example\example-DIH\solr\rss\conf\rss-data-config.xml by url="http://beautybooks88.blogspot.com/feeds/posts/default"; processor="XPathEntityProcessor" forEach="/feed/entry" transformer="DateFormatTransformer"> commonField="true" /> stripHTML="true"/> dateTimeFormat="-MM-dd'T'HH:mm:ss" /> and running the full dataimport from http://localhost:8983/solr/#/rss/dataimport//dataimport results in an error. 1) How could I have found the reason faster than I did - by looking into which log files,? 2) If you remove the first occurrence of /@href above, the import succeeds. (Note that the same pattern works for column "link".) What's the reason why?!! Best regards and thanks in advance Hans-Peter
Re: Problem with xpath expression in data-config.xml
Thanks for having analyzed the problem. But please let me note that I came to a somehow different conclusion. Define for the moment "title" to be the primary unique key: solr-4.3.0\example\example-DIH\solr\rss\conf\schema.xml title solr-4.3.0\example\example-DIH\solr\rss\conf\rss-data-config.xml [BAD CASE] (irrespective of the predicate @rel='self') http://beautybooks88.blogspot.com/feeds/posts/default"; processor="XPathEntityProcessor" forEach="/feed/entry" transformer="DateFormatTransformer"> [GOOD CASE] http://beautybooks88.blogspot.com/feeds/posts/default"; processor="XPathEntityProcessor" forEach="/feed/entry" transformer="DateFormatTransformer"> Conclusion: It has nothing to do with the number of occurrences of the pattern.
dataConfig DTD or schema
I wonder how to pass default values via , e.g. like this: BE or like this: In the course of this, I did not find a DTD or Schema for . Any hint is appreciated!!
Re: dataConfig DTD or schema
You are great! Thanks a lot for taking the time. -- From: "Shalin Shekhar Mangar" Sent: Friday, May 31, 2013 4:59 PM To: Subject: Re: dataConfig DTD or schema DataImportHandler does not support specifying default values for a field. However, the solr schema.xml lets you specify defaults. So, modify the corresponding field inside solr's schema.xml. For example: default="BE"/> On Fri, May 31, 2013 at 8:20 PM, Hans-Peter Stricker wrote: I wonder how to pass default values via , e.g. like this: BE or like this: In the course of this, I did not find a DTD or Schema for . Any hint is appreciated!! -- Regards, Shalin Shekhar Mangar.
Re: dataConfig DTD or schema
On the other side: I have a problem. Because I want to give some entities a default value "A" and others default value "B" - which I could do inside a inside of in data-config.xml but not inside a in schema.xml. -- From: "Shalin Shekhar Mangar" Sent: Friday, May 31, 2013 4:59 PM To: Subject: Re: dataConfig DTD or schema DataImportHandler does not support specifying default values for a field. However, the solr schema.xml lets you specify defaults. So, modify the corresponding field inside solr's schema.xml. For example: default="BE"/> On Fri, May 31, 2013 at 8:20 PM, Hans-Peter Stricker wrote: I wonder how to pass default values via , e.g. like this: BE or like this: In the course of this, I did not find a DTD or Schema for . Any hint is appreciated!! -- Regards, Shalin Shekhar Mangar.