Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I am getting HTTP Version Not Supported (505)Error

 
Edukondalu Avula
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Rusty Shackleford
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a HTTP version mismatch. That is your server doesn't support the version your client is sending. What server version are you using? It sounds like it is a very old version or is misconfigured. I am pretty sure that any
version of java from at least 1.4 should support the current HTTP 1.1.

Your best would be to run Wireshark and pay attention to both the HTTP response and request headers and see what version your client is sending and what versions your server supports. If they are the same, I am not sure what the next step should be.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic