Hi Friends,

I am working on Apache solr for indexing data by using java programming.
For Indexing data i used tomcat server and i started solr, i prepared url
for indexing data. i given that url in any browser it's working (indexed the
data). I given the prepared url in URL calss i got the HTTP Version Not
Supported and the error code is 505.

My Code is as follows

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ejb.bprocess.cataloguing;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;

/**
*
* @author Edukondalu
*/
public class TestSolr {

public static void main(String[] args) throws MalformedURLException,
IOException {
try {
String solrUrl = "http://localhost:9090/apache-solr";;

String strToAdd = "<add><doc><field
name=\"CatalogueRecordID\">121</field><field
name=\"OwnerLibraryID\">1</field><field
name=\"ID\">121_1</field></doc></add>";

String urlStr = solrUrl + "/update?stream.body=" + strToAdd;
System.out.println(".....................SOLR_SERVER_URL: " + urlStr);
URL indexUrl = new URL(urlStr);
HttpURLConnection indexConnection = (HttpURLConnection)
indexUrl.openConnection();
indexConnection.setRequestMethod("POST");
indexConnection.connect();
int code = indexConnection.getResponseCode();
System.out.println(".................Indexing..code: " + code);
System.out.println(".............Resp Msg For Indexing: " +
indexConnection.getResponseMessage());
System.out.println(".....................RequestMethod:" +
indexConnection.getRequestMethod());
String commitCmd = solrUrl + "/update?stream.body=<commit/>";
System.out.println(".....................commitCmd: " + commitCmd);

} catch (Exception e) {
e.printStackTrace();
}
}
}



the output is

.....................SOLR_SERVER_URL:
http://localhost:9090/apache-solr/update?stream.body=<add><doc><field
name="CatalogueRecordID">121</field><field
name="OwnerLibraryID">1</field><field name="ID">121_1</field></doc></add>
.................Indexing..code: 505
.............Resp Msg For Indexing: HTTP Version Not Supported
.....................RequestMethod:POST


If any have an idea help me
-- 
View this message in context: 
http://www.nabble.com/I-am-getting-HTTP-Version-Not-Supported-%28505%29Error-tp24409770p24409770.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to