Missing Content Stream

1,264 views
Skip to first unread message

Michael

unread,
Dec 23, 2009, 12:20:52 PM12/23/09
to PHP Solr Client
Hi all!
I have some problem with php solr client! When i try index data using
Apache_Solr_Service i get exception with message '"400" Status:
missing_content_stream'!
Here my code:
require_once 'Apache/Solr/Service.php';
require_once 'Apache/Solr/Document.php';
require_once 'Apache/Solr/Response.php';
$solr = new Apache_Solr_Service('localhost', '8983', '/solr');
if (!$solr->ping()) {
echo 'Solr service not responding.';
exit;
}
$document->addField("id", "XVT3","2");
$document->addField("name", "Popular item","2");
$solr->addDocument($document);
$solr->commit();
$solr->optimize();

Here exception:
SEVERE: org.apache.solr.common.SolrException: missing content stream

Donovan Jimenez

unread,
Dec 23, 2009, 1:16:22 PM12/23/09
to PHP Solr Client
Hi michael,

this exception usually happens when the post body (the XML) for an
operation is empty. I don't see any reason in your supplied code why
that should happen though, so I'd like to get some more information
from you:

what version of solr?
what version of the php solr client?
which call is the exception occurring (addDocument, commit, or
optimize)?

- donovan

Michael

unread,
Dec 24, 2009, 2:30:03 AM12/24/09
to PHP Solr Client
Hi Donovan

Solr: 1.4.0
php solr client: SolrPhpClient.r22.2009-11-09
exception occur in addDocument

Here request in the logs:
Dec 24, 2009 1:25:05 AM org.apache.solr.core.SolrCore execute
INFO: [] webapp=/solr path=/update params={wt=json&<add
allowDups="false"+overwritePending%3D"true"+overwriteCommitted
%3D"true"><doc><field+name%3D"id"+boost%3D"2">XVT3</field><field+name
%3D"name"+boost%3D"2">Popular+item</field></doc></add>} status=400
QTime=4

Michael

unread,
Dec 26, 2009, 9:28:40 AM12/26/09
to PHP Solr Client
Donovan Jimenez, I index files using java -jar post.jar *xml!
But when i use deleteByQuery, i get the same error!
Here code:
require_once ('Apache/Solr/Service.php');

$solr = new Apache_Solr_Service('localhost', '8983', '/solr');
if (!$solr->ping()) {
echo 'Solr service not responding.';
exit;
}
$solr->deleteByQuery('*:*');
$solr->commit();

Here error:
Fatal error: Uncaught exception 'Exception' with message '"400"
Status: Bad Request' in /usr/local/lib/Solr/Apache/Solr/Service.php:
385 Stack trace: #0 /usr/local/lib/Solr/Apache/Solr/Service.php(821):
Apache_Solr_Service->_sendRawPost('http://localhos...', NULL, 3600)
#1 /usr/local/lib/Solr/Apache/Solr/Service.php(903):
Apache_Solr_Service->delete(NULL, 3600) #2 /var/www/clean.php(8):
Apache_Solr_Service->deleteByQuery('*:*') #3 {main} thrown in /usr/
local/lib/Solr/Apache/Solr/Service.php on line 385

logs:


SEVERE: org.apache.solr.common.SolrException: missing content stream

....
Dec 26, 2009 8:26:46 AM org.apache.solr.core.SolrCore execute
INFO: [] webapp=/solr path=/update params={wt=json} status=400 QTime=3

Can you help me? Thank you...

Donovan Jimenez

unread,
Dec 28, 2009, 10:10:22 AM12/28/09
to PHP Solr Client
All your errors are related to PHP not sending the POST content body
like its supposed to. The client uses the HTTP stream context options
to do this with PHP's file_get_contents function. I haven't come found
a gotcha reason for why you'd be having this problem, but I haven't
asked the obvious question: what version of php are you using?

- Donovan

Michael

unread,
Dec 28, 2009, 10:28:32 AM12/28/09
to PHP Solr Client
I am using :
Apache-2.2.11
PHP- 5.2.9
I noticed some strange: if I use function such as addDocument,
deleteByQuery, commit, optimize(where use xml tags for post request) i
get error!
But if i use search function - there are no errors!
Maybe I must change some properties in the server settings? (php,
tomcat, java)

Donovan Jimenez

unread,
Dec 28, 2009, 3:03:15 PM12/28/09
to php-sol...@googlegroups.com
well the search function uses a HTTP GET request, while the other functions use POST requests. And from your solr exception traces the problem is in the POST request from php.  

I'm not sure where to guide you, unfortunately. I've searched the php manual for settings that might be disabling your php's ability to post content to solr. The only direct setting I've found is http://us.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen but it doesn't make sense in your case, since you seem to be making the request, its just that your post content isn't being transmitted.

can you try increasing your error reporting and see if anything shows in your php error log (if you're logging to a file) or to the page (if you're displaying html errors)?

- Donovan


--

You received this message because you are subscribed to the Google Groups "PHP Solr Client" group.
To post to this group, send email to php-sol...@googlegroups.com.
To unsubscribe from this group, send email to php-solr-clie...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/php-solr-client?hl=en.



Michael

unread,
Dec 29, 2009, 3:03:52 AM12/29/09
to PHP Solr Client
I try to change some properties in php.ini, but it not help!
There is feature: When i start solr using java -jar start.jar I get:
"missing_content_stream", but when i start solr under tomcat I get :
"Bad request";
Here php logs: (tomcat)

[29-Dec-2009 01:45:42] PHP Fatal error: Uncaught exception


'Exception' with message '"400" Status: Bad Request' in /usr/local/lib/

Solr/Apache/Solr/Service.php:385
Stack trace:
#0 /usr/local/lib/Solr/Apache/Solr/Service.php(821):
Apache_Solr_Service->_sendRawPost('http://localhos...', '<delete
fromPen...', 3600)
#1 /usr/local/lib/Solr/Apache/Solr/Service.php(899):
Apache_Solr_Service->delete('<delete fromPen...', 3600)
#2 /var/www/clean.php(9): Apache_Solr_Service->deleteByQuery('*:*')


#3 {main}
thrown in /usr/local/lib/Solr/Apache/Solr/Service.php on line 385

(java -jar start.jar ):

[29-Dec-2009 01:54:58] PHP Fatal error: Uncaught exception
'Exception' with message '"400" Status: missing_content_stream' in /
usr/local/lib/Solr/Apache/Solr/Service.php:385
Stack trace:
#0 /usr/local/lib/Solr/Apache/Solr/Service.php(821):
Apache_Solr_Service->_sendRawPost('http://localhos...', '<delete
fromPen...', 3600)
#1 /usr/local/lib/Solr/Apache/Solr/Service.php(899):
Apache_Solr_Service->delete('<delete fromPen...', 3600)
#2 /var/www/clean.php(9): Apache_Solr_Service->deleteByQuery('*:*')


#3 {main}
thrown in /usr/local/lib/Solr/Apache/Solr/Service.php on line 385

And when I start solr, I noticed :

Dec 29, 2009 2:02:12 AM org.apache.solr.core.SolrResourceLoader
locateSolrHome
INFO: solr home defaulted to 'solr/' (could not find system property
or JNDI)
Dec 29, 2009 2:02:12 AM org.apache.solr.servlet.SolrServlet init
INFO: SolrServlet.init() done
Dec 29, 2009 2:02:12 AM org.apache.solr.core.SolrResourceLoader
locateSolrHome
INFO: JNDI not configured for solr (NoInitialContextEx)


Michael

unread,
Dec 29, 2009, 1:06:09 PM12/29/09
to PHP Solr Client
maybe mod_jk can help me ... Is this connector binding?

Michael

unread,
Dec 30, 2009, 7:14:42 AM12/30/09
to PHP Solr Client
I install mod_jk, but it not help! Tomcat start on 8080 port, mod_jk
listening 8009 port! I get the same problem :
at the page:

Uncaught exception 'Exception' with message '"400" Status: Bad
Request'
at the tomcat logs:

Michael

unread,
Jan 4, 2010, 2:55:30 AM1/4/10
to PHP Solr Client
Hi, Donovan!
Maybe problem in Content-Length! What can you say about this?

Michael

unread,
Jan 5, 2010, 4:51:00 AM1/5/10
to PHP Solr Client
What modules or settings need for apache to work with tomcat(solr)?

GeoffB

unread,
Jan 21, 2010, 3:10:56 PM1/21/10
to PHP Solr Client
I get exactly the same response - how exciting! I'm using PHP 5.3,
Solr 1.4.

Michael

unread,
Jan 21, 2010, 4:34:25 PM1/21/10
to PHP Solr Client
I resolved this problem in such way: I use Andrei Savu client! His
client is based on Donovan Jimenez's client, but he use cURL for post
request! Donovan Jimenez use file_get_contents method!

Michael

unread,
Jan 21, 2010, 4:36:00 PM1/21/10
to PHP Solr Client
Here is this client
http://github.com/andreisavu/solr-php-client-curl
I hope this will help you ...

Geoff Bentley

unread,
Jan 21, 2010, 4:51:11 PM1/21/10
to php-sol...@googlegroups.com
Many thanks Michael!

2010/1/22 Michael <michael...@gmail.com>
Here is this client
http://github.com/andreisavu/solr-php-client-curl
I hope this will help you ...

Jeff

unread,
Jun 18, 2012, 10:31:22 AM6/18/12
to php-sol...@googlegroups.com
i am getting following error on using $solr->commit();

exception 'Apache_Solr_HttpTransportException' with message ''400' Status: Bad Request' in C:\wamp\www\solr_test\SolrPhpClient\Apache\Solr\Service.php:364
Stack trace:
#0 C:\wamp\www\solr_test\SolrPhpClient\Apache\Solr\Service.php(830): Apache_Solr_Service->_sendRawPost('http://localhos...', 'commit()
#2 {main}

please help i am trying to debug this for past 4 days . i have attached the code that i am running
test.php

Michael Nazaruk

unread,
Jun 18, 2012, 10:37:17 AM6/18/12
to php-sol...@googlegroups.com
When you create apache solr service object, try to use Apache_Solr_HttpTransport_Curl transport. Such as

$apacheService = new Apache_Solr_Service('localhost', '8080', '/solr/', new Apache_Solr_HttpTransport_Curl());


2012/6/18 Jeff <jeph.a...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "PHP Solr Client" group.
To view this discussion on the web visit https://groups.google.com/d/msg/php-solr-client/-/Nnk3_LHAKO4J.

Michael

unread,
Jun 18, 2012, 10:40:56 AM6/18/12
to php-sol...@googlegroups.com
Or see tomcat\jetty logs. Maybe, you have wrong schema.


2012/6/18 Jeff <jeph.a...@gmail.com>
To post to this group, send email to php-solr-client@googlegroups.com.
To unsubscribe from this group, send email to php-solr-client+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages