aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
Author

I am getting HTTP Version Not Supported (505)Error

Edukondalu Avula
Greenhorn

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.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

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I am getting HTTP Version Not Supported (505)Error
 
Similar Threads
current thread not owner
how to write content to an XML file ?
SOAPException: Error opening socket
dns monitoring using java query
Strange behaviour in HttpURLConnection to Servlet communication