This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes I am getting HTTP Version Not Supported (505)Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "I am getting HTTP Version Not Supported (505)Error" Watch "I am getting HTTP Version Not Supported (505)Error" New topic

I am getting HTTP Version Not Supported (505)Error

Edukondalu Avula

Joined: Oct 03, 2008
Posts: 5
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.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();
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) {

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

If any have an idea help me

Rusty Shackleford
Ranch Hand

Joined: Jan 03, 2006
Posts: 490
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.

"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: I am getting HTTP Version Not Supported (505)Error
Similar Threads
current thread not owner
dns monitoring using java query
how to write content to an XML file ?
Strange behaviour in HttpURLConnection to Servlet communication
SOAPException: Error opening socket