solrj error
Hi I am using solrj 4.6 for accessing solr 4.6.As a test case for my application, I created a servlet which holds the SolrJ connection via zookeeper. When I run the test, I am getting a weird stack trace. The test fails on not finding a currency file of java. This file I believe used to be present in java 1.6. Is somehow solrj 4.6 coupled with java 1.6? Any other ideas? Caused by: java.lang.InternalError at java.util.Currency$1.run(Currency.java:224) at java.security.AccessController.doPrivileged(Native Method) at java.util.Currency.clinit(Currency.java:192) at java.text.DecimalFormatSymbols.initialize(DecimalFormatSymbols .java:585) at java.text.DecimalFormatSymbols.init(DecimalFormatSymbols. java:94) at java.text.DecimalFormatSymbols.getInstance( DecimalFormatSymbols.java:157) at java.text.NumberFormat.getInstance(NumberFormat.java:767) at java.text.NumberFormat.getIntegerInstance(NumberFormat.java: 439) at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java: 664) at java.text.SimpleDateFormat.init(SimpleDateFormat.java:585) at org.apache.solr.common.util.DateUtil$ThreadLocalDateFormat. init(DateUtil.java:187) at org.apache.solr.common.util.DateUtil.clinit(DateUtil.java: 179) at org.apache.solr.client.solrj.util.ClientUtils.clinit( ClientUtils.java:193) at org.apache.solr.client.solrj.impl.CloudSolrServer.request( CloudSolrServer.java:565) at org.apache.solr.client.solrj.request.QueryRequest.process( QueryRequest.java:90) at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java: 310) at com.qbase.gsn.SearchServlet.doGet(SearchServlet.java:121) ... 21 more Caused by: java.io.FileNotFoundException: /opt/jdk1.7.0_25/lib/currency. data (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.init(FileInputStream.java:138) at java.io.FileInputStream.init(FileInputStream.java:97) at java.util.Currency$1.run(Currency.java:198) ... 37 more Thanks Vivek P.S. : I tried to force /opt/jdk1.7 to be java.home thinking the execution path will change but the bug remained. Also there is no java 1.6 on the machine
Re: solrj error
Clearly you're going to need to deposit 25 cents to make that call. :) More seriously, I'm wondering if most of the issue is environment-related, since it seems like it's looking for that file on your system based on the path. I checked my machine and it doesn't have a $JAVA_HOME/lib/currency.data file either. Is it possible that you have somehow used a mismatched JAVA_HOME and tools.jar somehow? Michael Della Bitta Applications Developer o: +1 646 532 3062 appinions inc. “The Science of Influence Marketing” 18 East 41st Street New York, NY 10017 t: @appinions https://twitter.com/Appinions | g+: plus.google.com/appinions https://plus.google.com/u/0/b/112002776285509593336/112002776285509593336/posts w: appinions.com http://www.appinions.com/ On Tue, Jun 17, 2014 at 12:03 PM, Vivek Pathak vpat...@orgmeta.com wrote: Hi I am using solrj 4.6 for accessing solr 4.6.As a test case for my application, I created a servlet which holds the SolrJ connection via zookeeper. When I run the test, I am getting a weird stack trace. The test fails on not finding a currency file of java. This file I believe used to be present in java 1.6. Is somehow solrj 4.6 coupled with java 1.6? Any other ideas? Caused by: java.lang.InternalError at java.util.Currency$1.run(Currency.java:224) at java.security.AccessController.doPrivileged(Native Method) at java.util.Currency.clinit(Currency.java:192) at java.text.DecimalFormatSymbols.initialize(DecimalFormatSymbols .java:585) at java.text.DecimalFormatSymbols.init(DecimalFormatSymbols. java:94) at java.text.DecimalFormatSymbols.getInstance( DecimalFormatSymbols.java:157) at java.text.NumberFormat.getInstance(NumberFormat.java:767) at java.text.NumberFormat.getIntegerInstance(NumberFormat.java: 439) at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java: 664) at java.text.SimpleDateFormat.init(SimpleDateFormat.java:585) at org.apache.solr.common.util.DateUtil$ThreadLocalDateFormat. init(DateUtil.java:187) at org.apache.solr.common.util.DateUtil.clinit(DateUtil.java: 179) at org.apache.solr.client.solrj.util.ClientUtils.clinit( ClientUtils.java:193) at org.apache.solr.client.solrj.impl.CloudSolrServer.request( CloudSolrServer.java:565) at org.apache.solr.client.solrj.request.QueryRequest.process( QueryRequest.java:90) at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java: 310) at com.qbase.gsn.SearchServlet.doGet(SearchServlet.java:121) ... 21 more Caused by: java.io.FileNotFoundException: /opt/jdk1.7.0_25/lib/currency. data (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.init(FileInputStream.java:138) at java.io.FileInputStream.init(FileInputStream.java:97) at java.util.Currency$1.run(Currency.java:198) ... 37 more Thanks Vivek P.S. : I tried to force /opt/jdk1.7 to be java.home thinking the execution path will change but the bug remained. Also there is no java 1.6 on the machine
Re: solrj error
Thanks Michael. This indeed had something to do with environment. mvn test is running the test case without properly initialized environment. Once I added System.setProperty( java.home , /opt/jdk.../jre/ ) ; - it started found the currency.data and moved on So it is clearly not solr - but if you have an idea of how to properly init the system properties in mvn test - then you can surely point out. Thanks... On Tue, Jun 17, 2014 at 12:16 PM, Michael Della Bitta michael.della.bi...@appinions.com wrote: Clearly you're going to need to deposit 25 cents to make that call. :) More seriously, I'm wondering if most of the issue is environment-related, since it seems like it's looking for that file on your system based on the path. I checked my machine and it doesn't have a $JAVA_HOME/lib/currency.data file either. Is it possible that you have somehow used a mismatched JAVA_HOME and tools.jar somehow? Michael Della Bitta Applications Developer o: +1 646 532 3062 appinions inc. “The Science of Influence Marketing” 18 East 41st Street New York, NY 10017 t: @appinions https://twitter.com/Appinions | g+: plus.google.com/appinions https://plus.google.com/u/0/b/112002776285509593336/112002776285509593336/posts w: appinions.com http://www.appinions.com/ On Tue, Jun 17, 2014 at 12:03 PM, Vivek Pathak vpat...@orgmeta.com wrote: Hi I am using solrj 4.6 for accessing solr 4.6.As a test case for my application, I created a servlet which holds the SolrJ connection via zookeeper. When I run the test, I am getting a weird stack trace. The test fails on not finding a currency file of java. This file I believe used to be present in java 1.6. Is somehow solrj 4.6 coupled with java 1.6? Any other ideas? Caused by: java.lang.InternalError at java.util.Currency$1.run(Currency.java:224) at java.security.AccessController.doPrivileged(Native Method) at java.util.Currency.clinit(Currency.java:192) at java.text.DecimalFormatSymbols.initialize(DecimalFormatSymbols .java:585) at java.text.DecimalFormatSymbols.init(DecimalFormatSymbols. java:94) at java.text.DecimalFormatSymbols.getInstance( DecimalFormatSymbols.java:157) at java.text.NumberFormat.getInstance(NumberFormat.java:767) at java.text.NumberFormat.getIntegerInstance(NumberFormat.java: 439) at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java: 664) at java.text.SimpleDateFormat.init(SimpleDateFormat.java:585) at org.apache.solr.common.util.DateUtil$ThreadLocalDateFormat. init(DateUtil.java:187) at org.apache.solr.common.util.DateUtil.clinit(DateUtil.java: 179) at org.apache.solr.client.solrj.util.ClientUtils.clinit( ClientUtils.java:193) at org.apache.solr.client.solrj.impl.CloudSolrServer.request( CloudSolrServer.java:565) at org.apache.solr.client.solrj.request.QueryRequest.process( QueryRequest.java:90) at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java: 310) at com.qbase.gsn.SearchServlet.doGet(SearchServlet.java:121) ... 21 more Caused by: java.io.FileNotFoundException: /opt/jdk1.7.0_25/lib/currency. data (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.init(FileInputStream.java:138) at java.io.FileInputStream.init(FileInputStream.java:97) at java.util.Currency$1.run(Currency.java:198) ... 37 more Thanks Vivek P.S. : I tried to force /opt/jdk1.7 to be java.home thinking the execution path will change but the bug remained. Also there is no java 1.6 on the machine
Re: SOLRJ - Error while using CommonsHttpSolrServer
On 11/01/2012 05:06 AM, Jegannathan Mehalingam wrote: Here is my code which uses CommonsHttpSolrServer: String url = http://localhost:8983/solr/#/solr/update/;; your solr url looks wrong, try this : http://localhost:8983/solr/update/ or maybe this one is you have a core named solr : http://localhost:8983/solr/solr/update/ André -- André Bois-Crettez Search technology, Kelkoo http://www.kelkoo.com/ Kelkoo SAS Société par Actions Simplifiée Au capital de € 4.168.964,30 Siège social : 8, rue du Sentier 75002 Paris 425 093 069 RCS Paris Ce message et les pièces jointes sont confidentiels et établis à l'attention exclusive de leurs destinataires. Si vous n'êtes pas le destinataire de ce message, merci de le détruire et d'en avertir l'expéditeur.
Re: SOLRJ - Error while using CommonsHttpSolrServer
On 10/31/2012 10:06 PM, Jegannathan Mehalingam wrote: - I tried using HttpSolrServer, but had some problems and some news groups mentioned that it is buggy and I should be using CommonsHttpSolrServer. So, I am using CommonsHttpSolrServer. But both approaches does not work. - I have tried using SOLR 4.0 as well as 3.6.1. I get errors in both cases. - I started SOLR server from C:\apche_solr\apache-solr-4.0.0\example using the command java -Dsolr.solr.home=./example-DIH/solr/ -jar start.jar 1logs/dih.log 21 Here is my code which uses CommonsHttpSolrServer: String url = http://localhost:8983/solr/#/solr/update/;; This right here is your problem. The URL you have given here is a URL for the 4.0 admin interface. Chances are what you really want is this, replacing CORENAME with the actual name of your core: String url = http://localhost:8983/solr/CORENAME/;; try { CommonsHttpSolrServer server = new CommonsHttpSolrServer( url ); server.setSoTimeout(1000); // socket read timeout server.setConnectionTimeout(100); server.setDefaultMaxConnectionsPerHost(100); server.setMaxTotalConnections(100); server.setFollowRedirects(false); // defaults to false server.setAllowCompression(false); server.setMaxRetries(1); // defaults to 0. 1 not recommended. server.setParser(new XMLResponseParser()); // binary parser is used by default Go with HttpSolrServer. There are problems with it on SolrJ 3.6.0, but I think they are fixed in 3.6.1. CommonsHttpSolrServer doesn't exist at all in SolrJ 4.0. XMLResponseParser is *ONLY* required if your Solr and SolrJ versions are wildly different. The javabin format changed version number between 1.4.1 and 3.1.0, and the two versions are completely incompatible. If both ends are on 3.1 or later, javabin is fine. XML is slightly slower than javabin. Most of the SolrJ options you have set here are unnecessary. Unless you run into an actual problem with the low level TCP/HTTP settings, the only ones you should initially have are setConnectionTimeout and setMaxRetries. You've configured a connection timeout of 100 milliseconds. In perfect conditions on a LAN, this is enough, but if conditions are less than ideal, it may not be. I personally use a value of 15000, but you may want to go with 5000. Your setMaxRetries looks appropriate, and is the value that I use. I would lose all the other options. Thanks, Shawn
Re: SOLRJ - Error while using CommonsHttpSolrServer
I am using the default solr.xml that came with the installation. The core name is defined as solr. So, I changed the url to http://localhost:8983/solr/solr/; and that resolves the issue. I also replaced CommonsHttpSolrServer with HttpSolrServer and this works as well. I tried both XMLResponseParser as well as the default binary parser. Both of them works as expected. Thanks, Jegan On 11/1/2012 2:10 AM, Shawn Heisey wrote: On 10/31/2012 10:06 PM, Jegannathan Mehalingam wrote: - I tried using HttpSolrServer, but had some problems and some news groups mentioned that it is buggy and I should be using CommonsHttpSolrServer. So, I am using CommonsHttpSolrServer. But both approaches does not work. - I have tried using SOLR 4.0 as well as 3.6.1. I get errors in both cases. - I started SOLR server from C:\apche_solr\apache-solr-4.0.0\example using the command java -Dsolr.solr.home=./example-DIH/solr/ -jar start.jar 1logs/dih.log 21 Here is my code which uses CommonsHttpSolrServer: String url = http://localhost:8983/solr/#/solr/update/;; This right here is your problem. The URL you have given here is a URL for the 4.0 admin interface. Chances are what you really want is this, replacing CORENAME with the actual name of your core: String url = http://localhost:8983/solr/CORENAME/;; try { CommonsHttpSolrServer server = new CommonsHttpSolrServer( url ); server.setSoTimeout(1000); // socket read timeout server.setConnectionTimeout(100); server.setDefaultMaxConnectionsPerHost(100); server.setMaxTotalConnections(100); server.setFollowRedirects(false); // defaults to false server.setAllowCompression(false); server.setMaxRetries(1); // defaults to 0. 1 not recommended. server.setParser(new XMLResponseParser()); // binary parser is used by default Go with HttpSolrServer. There are problems with it on SolrJ 3.6.0, but I think they are fixed in 3.6.1. CommonsHttpSolrServer doesn't exist at all in SolrJ 4.0. XMLResponseParser is *ONLY* required if your Solr and SolrJ versions are wildly different. The javabin format changed version number between 1.4.1 and 3.1.0, and the two versions are completely incompatible. If both ends are on 3.1 or later, javabin is fine. XML is slightly slower than javabin. Most of the SolrJ options you have set here are unnecessary. Unless you run into an actual problem with the low level TCP/HTTP settings, the only ones you should initially have are setConnectionTimeout and setMaxRetries. You've configured a connection timeout of 100 milliseconds. In perfect conditions on a LAN, this is enough, but if conditions are less than ideal, it may not be. I personally use a value of 15000, but you may want to go with 5000. Your setMaxRetries looks appropriate, and is the value that I use. I would lose all the other options. Thanks, Shawn
SOLRJ - Error while using CommonsHttpSolrServer
- I tried using HttpSolrServer, but had some problems and some news groups mentioned that it is buggy and I should be using CommonsHttpSolrServer. So, I am using CommonsHttpSolrServer. But both approaches does not work. - I have tried using SOLR 4.0 as well as 3.6.1. I get errors in both cases. - I started SOLR server from C:\apche_solr\apache-solr-4.0.0\example using the command java -Dsolr.solr.home=./example-DIH/solr/ -jar start.jar 1logs/dih.log 21 Here is my code which uses CommonsHttpSolrServer: String url = http://localhost:8983/solr/#/solr/update/;; try { CommonsHttpSolrServer server = new CommonsHttpSolrServer( url ); server.setSoTimeout(1000); // socket read timeout server.setConnectionTimeout(100); server.setDefaultMaxConnectionsPerHost(100); server.setMaxTotalConnections(100); server.setFollowRedirects(false); // defaults to false server.setAllowCompression(false); server.setMaxRetries(1); // defaults to 0. 1 not recommended. server.setParser(new XMLResponseParser()); // binary parser is used by default SolrInputDocument doc2 = new SolrInputDocument(); doc2.addField( OR, 119.96); doc2.addField( M, 1); doc2.addField( PT, 94.5946); doc2.addField( PY , 12); doc2.addField( LR , 118); doc2.addField( PC, FST 04/26/12); doc2.addField( SN , OTHER); doc2.addField( CE, 2012-05-04T04:00:00Z); doc2.addField( VC, 184); doc2.addField( VR, 24563); doc2.addField( PR, 4539673); doc2.addField( SE, 2012-04-30T04:00:00Z); doc2.addField( IE, 2012-05-08T04:00:00Z); doc2.addField( ZR, 4539673); doc2.addField( PNT, 94.61079); doc2.addField( GY, 17); doc2.addField( id, 111_111_1_11_2); doc2.addField( PAR, 359.88); doc2.addField( CTE, 2012-04-26T04:00:00Z); doc2.addField( LE, PDS LOCATION); doc2.addField( DR, 691); doc2.addField( OY, 4); doc2.addField( SS, 10); CollectionSolrInputDocument docs = new ArrayListSolrInputDocument(); docs.add( doc2 ); UpdateResponse resp = server.add( docs ); System.out.println(resp.getResponse()); server.commit(true, true); } catch (Exception e) { System.out.println(e); e.printStackTrace(); } When I run this code, I get the following exception: org.apache.solr.common.SolrException: parsing error org.apache.solr.common.SolrException: parsing error at org.apache.solr.client.solrj.impl.XMLResponseParser.processResponse(XMLResponseParser.java:143) at org.apache.solr.client.solrj.impl.XMLResponseParser.processResponse(XMLResponseParser.java:104) at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:469) at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:249) at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:105) at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:69) at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:54) at SolrIndexClient.indexTest(SolrIndexClient.java:117) at SolrIndexClient.main(SolrIndexClient.java:139) Caused by: java.lang.Exception: really needs to be response or result. not:html at org.apache.solr.client.solrj.impl.XMLResponseParser.processResponse(XMLResponseParser.java:134) Any idea what is going on? I do not see anything in the log file. I am not sure if my request is even hitting the server. In our implementation, we need to update the indexes programatically in near-real time. If we can't do this, then SOLR is unusable for us . Thanks in advance, Jegan Mehalingam