lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gunther, Andrew" <Gunth...@si.edu>
Subject RE: Solrj - when a request fails
Date Fri, 23 Sep 2011 13:33:59 GMT
All the solr methods look like they should throw those 2 exceptions.
Have you tried the DirectXmlRequest method?

up.process(solrServer);

  public UpdateResponse process( SolrServer server ) throws SolrServerException, IOException
  {
    long startTime = System.currentTimeMillis();
    UpdateResponse res = new UpdateResponse();
    res.setResponse( server.request( this ) );
    res.setElapsedTime( System.currentTimeMillis()-startTime );
    return res;
  }
________________________________________
From: Walter Closenfleight [walter.p.closenfleight@gmail.com]
Sent: Friday, September 23, 2011 8:55 AM
To: solr-user@lucene.apache.org
Subject: Solrj - when a request fails

*
I have a java program which sends thousands of Solr XML files up to Solr
using the following code. It works fine until there is a problem with one of
the Solr XML files. The code fails on the solrServer.request(up) line, but
it does not throw an exception, my application therefore cannot catch it and
recover, and my whole application dies.

I've fixed this individual file that made it fail, but want to better trap
these so my application does not die.

Thanks for any insight you can provide. Java code and log below-


// ... start of a loop to process each file removed ...

try {

   String xml = read(filename);
   DirectXmlRequest up = new DirectXmlRequest( "/update", xml );

   solrServer.request( up );
   solrServer.commit();

} catch (SolrServerException e) {
   log.warn("Exception: "+ e.toString());
   throw new MyException(e);
} catch (IOException e) {
   log.warn("Exception: "+ e.toString());
   throw new MyException(e);
}
DEBUG >> "[\n]" - (Wire.java:70)
DEBUG Request body sent - (EntityEnclosingMethod.java:508)
DEBUG << "HTTP/1.1 400 Bad Request[\r][\n]" - (Wire.java:70)
DEBUG << "HTTP/1.1 400 Bad Request[\r][\n]" - (Wire.java:70)
DEBUG << "Server: Apache-Coyote/1.1[\r][\n]" - (Wire.java:70)
DEBUG << "Content-Type: text/html;charset=utf-8[\r][\n]" - (Wire.java:70)
DEBUG << "Content-Length: 1271[\r][\n]" - (Wire.java:70)
DEBUG << "Date: Fri, 23 Sep 2011 12:08:05 GMT[\r][\n]" - (Wire.java:70)
DEBUG << "Connection: close[\r][\n]" - (Wire.java:70)
DEBUG << "[\r][\n]" - (Wire.java:70)
DEBUG << "<html><head><title>Apache Tomcat/6.0.29 - Error
report</title><style><!--H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
BODY
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
{color : black;}A.name {color : black;}HR {color : #525D76;}--></style>
</head><body><h1>HTTP Status 400 - Unexpected character 'x' (code 120) in
prolog; expected '&lt;'[\n]" - (Wire.java:70)
DEBUG << " at [row,col {unknown-source}]: [3,1]</h1><HR size="1"
noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b>
<u>Unexpected character 'x' (code 120) in prolog; expected '&lt;'[\n]" -
(Wire.java:70)
DEBUG << " at [row,col {unknown-source}]: [3,1]</u></p><p><b>description</b>
" - (Wire.java:84)
DEBUG << "<u>The request sent by the client was syntactically incorrect
(Unexpected character 'x' (code 120) in prolog; expected '&lt;'[\n]" -
(Wire.java:70)
DEBUG << " at [row,col {unknown-source}]: [3,1]).</u></p><HR size="1"
noshade="noshade"><h3>Apache Tomcat/6.0.29</h3></body></html>"
-
(Wire.java:84)
DEBUG Should close connection in response to directive: close -
(HttpMethodBase.java:1008)
*

Mime
View raw message