You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Pavel Hladik <pa...@profimedia.cz> on 2015/04/17 07:57:30 UTC
Bad contentType for search handler :text/xml; charset=UTF-8
Hi,
we have migrated Solr from 5.0 do 5.1 and we can't search now, we have a
ERROR for SolrCore like in subject. I can't get any info through Google.
Please, can someone help what is going on?
Thanks,
Pavel
--
View this message in context: http://lucene.472066.n3.nabble.com/Bad-contentType-for-search-handler-text-xml-charset-UTF-8-tp4200314.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Bad contentType for search handler :text/xml; charset=UTF-8
Posted by Erick Erickson <er...@gmail.com>.
Not unless you provide a lot more details. Specifically, anything in your Solr
logs that looks suspicious _and_ in your container logs (Tomcat? Jetty?).
Plus the message you sent.
Please review:
http://wiki.apache.org/solr/UsingMailingLists
Best,
Erick
On Thu, Apr 16, 2015 at 10:57 PM, Pavel Hladik
<pa...@profimedia.cz> wrote:
> Hi,
>
> we have migrated Solr from 5.0 do 5.1 and we can't search now, we have a
> ERROR for SolrCore like in subject. I can't get any info through Google.
>
> Please, can someone help what is going on?
>
> Thanks,
>
> Pavel
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Bad-contentType-for-search-handler-text-xml-charset-UTF-8-tp4200314.html
> Sent from the Solr - User mailing list archive at Nabble.com.
Re: Bad contentType for search handler :text/xml; charset=UTF-8
Posted by Pavel Hladik <pa...@profimedia.cz>.
Hi, our developers solved the problem. We are using Solarium and we had to
learn Solarium to use selects with content-type:
application/x-www-form-urlencoded
Pavel
--
View this message in context: http://lucene.472066.n3.nabble.com/Bad-contentType-for-search-handler-text-xml-charset-UTF-8-tp4200314p4201848.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Bad contentType for search handler :text/xml; charset=UTF-8
Posted by didier deshommes <df...@gmail.com>.
On Wed, Apr 22, 2015 at 4:17 PM, Yonik Seeley <ys...@gmail.com> wrote:
> On Wed, Apr 22, 2015 at 11:00 AM, didier deshommes <df...@gmail.com>
> wrote:
> > curl "
> >
> http://localhost:8983/solr/gettingstarted/select?wt=json&indent=true&q=foundation
> "
> > -H "Content-type:application/json"
>
> You're telling Solr the body encoding is JSON, but then you don't send any
> body.
> We could catch that error earlier perhaps, but it still looks like an
> error?
>
>
Agreed, it's still an error. But the traceback looks like something
horrible has happened to Solr, and is not particularly informative to the
user. An error message like "Empty request body" would help.
I suspect that this issue about content-type may come up again in libraries
that interact with Solr since its behavior pre-5.1 was to just ignore empty
body requests and return the response anyway.
-Yonik
>
Re: Bad contentType for search handler :text/xml; charset=UTF-8
Posted by Yonik Seeley <ys...@gmail.com>.
On Wed, Apr 22, 2015 at 11:00 AM, didier deshommes <df...@gmail.com> wrote:
> curl "
> http://localhost:8983/solr/gettingstarted/select?wt=json&indent=true&q=foundation"
> -H "Content-type:application/json"
You're telling Solr the body encoding is JSON, but then you don't send any body.
We could catch that error earlier perhaps, but it still looks like an error?
-Yonik
Re: Bad contentType for search handler :text/xml; charset=UTF-8
Posted by didier deshommes <df...@gmail.com>.
A similar problem seems to happen when sending application/json to the
search handler. Solr returns a NullPointerException for some reason:
vagrant@precise64:~/solr-5.1.0$ curl "
http://localhost:8983/solr/gettingstarted/select?wt=json&indent=true&q=foundation"
-H "Content-type:application/json"
{
"responseHeader":{
"status":500,
"QTime":2,
"params":{
"indent":"true",
"json":"",
"q":"foundation",
"wt":"json"}},
"error":{
"trace":"java.lang.NullPointerException\n\tat
org.apache.solr.request.json.ObjectUtil$ConflictHandler.mergeMap(ObjectUtil.java:60)\n\tat
org.apache.solr.request.json.ObjectUtil.mergeObjects(ObjectUtil.java:114)\n\tat
org.apache.solr.request.json.RequestUtil.mergeJSON(RequestUtil.java:259)\n\tat
org.apache.solr.request.json.RequestUtil.processParams(RequestUtil.java:176)\n\tat
org.apache.solr.util.SolrPluginUtils.setDefaults(SolrPluginUtils.java:166)\n\tat
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:140)\n\tat
org.apache.solr.core.SolrCore.execute(SolrCore.java:1984)\n\tat
org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:829)\n\tat
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:446)\n\tat
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:220)\n\tat
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)\n\tat
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)\n\tat
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)\n\tat
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)\n\tat
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)\n\tat
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)\n\tat
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)\n\tat
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)\n\tat
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)\n\tat
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)\n\tat
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)\n\tat
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)\n\tat
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)\n\tat
org.eclipse.jetty.server.Server.handle(Server.java:368)\n\tat
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)\n\tat
org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)\n\tat
org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:942)\n\tat
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1004)\n\tat
org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640)\n\tat
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)\n\tat
org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)\n\tat
org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)\n\tat
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)\n\tat
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)\n\tat
java.lang.Thread.run(Thread.java:745)\n",
"code":500}}
On Wed, Apr 22, 2015 at 9:41 AM, Walter Underwood <wu...@wunderwood.org>
wrote:
> text/xml is not a safe content-type, because of the way that HTTP handles
> charsets. Always use application/xml.
>
> wunder
> Walter Underwood
> wunder@wunderwood.org
> http://observer.wunderwood.org/ (my blog)
>
>
> On Apr 22, 2015, at 3:01 AM, bengates <be...@aliceadsl.fr> wrote:
>
> > Looks like Solarium hardcodes a default header "Content-Type: text/xml;
> > charset=utf-8" if none provided.
> > Removing it solves the problem.
> >
> > It seems that Solr 5.1 doesn't support this content-type.
> >
> >
> >
> > --
> > View this message in context:
> http://lucene.472066.n3.nabble.com/Bad-contentType-for-search-handler-text-xml-charset-UTF-8-tp4200314p4201579.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
>
>
Re: Bad contentType for search handler :text/xml; charset=UTF-8
Posted by Walter Underwood <wu...@wunderwood.org>.
text/xml is not a safe content-type, because of the way that HTTP handles charsets. Always use application/xml.
wunder
Walter Underwood
wunder@wunderwood.org
http://observer.wunderwood.org/ (my blog)
On Apr 22, 2015, at 3:01 AM, bengates <be...@aliceadsl.fr> wrote:
> Looks like Solarium hardcodes a default header "Content-Type: text/xml;
> charset=utf-8" if none provided.
> Removing it solves the problem.
>
> It seems that Solr 5.1 doesn't support this content-type.
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Bad-contentType-for-search-handler-text-xml-charset-UTF-8-tp4200314p4201579.html
> Sent from the Solr - User mailing list archive at Nabble.com.
Re: Bad contentType for search handler :text/xml; charset=UTF-8
Posted by bengates <be...@aliceadsl.fr>.
Looks like Solarium hardcodes a default header "Content-Type: text/xml;
charset=utf-8" if none provided.
Removing it solves the problem.
It seems that Solr 5.1 doesn't support this content-type.
--
View this message in context: http://lucene.472066.n3.nabble.com/Bad-contentType-for-search-handler-text-xml-charset-UTF-8-tp4200314p4201579.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Bad contentType for search handler :text/xml; charset=UTF-8
Posted by bengates <be...@aliceadsl.fr>.
Hello,
I've got the same issue after an upgrade from Solr 5.0 to 5.1, even on GET
requests.
Actually i'm using PHP Solarium library to perform my requests. This is the
error the library gets now, on a search handler. The request is transported
with cUrl.
What's weird is when I copy/paste the Url Solarium generates in my browser,
I don't get the error.
Maybe Solr 5.1 requires a new header which is automatically sent by the
browser but not by cUrl.
I'll investigate on this...
Ben
--
View this message in context: http://lucene.472066.n3.nabble.com/Bad-contentType-for-search-handler-text-xml-charset-UTF-8-tp4200314p4201564.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Bad contentType for search handler :text/xml; charset=UTF-8
Posted by Chris Hostetter <ho...@fucit.org>.
Off the cuff, it sounds like you are making a POST request to the
SearchHandler (ie: /search or /query) and the Content-TYpe you are sending
is "text/xml; charset=UTF-8"
In the past SearchHandler might have ignored that Content-Type, but now
that structured queries can be sent as POST data, it's trying to parse the
POST body and it can't make sense of your XML data.
As erick said: with out more details on what your client code looks like
it's hard to give you additional advice -- the first big question you wnat
to ask yourself though, is *why*, in SOlr 5.0, you were POSTing XML data
to Solr -- what was the purpose of that POSTed XML data?
: Date: Thu, 16 Apr 2015 22:57:30 -0700 (MST)
: From: Pavel Hladik <pa...@profimedia.cz>
: Reply-To: solr-user@lucene.apache.org
: To: solr-user@lucene.apache.org
: Subject: Bad contentType for search handler :text/xml; charset=UTF-8
:
: Hi,
:
: we have migrated Solr from 5.0 do 5.1 and we can't search now, we have a
: ERROR for SolrCore like in subject. I can't get any info through Google.
:
: Please, can someone help what is going on?
:
: Thanks,
:
: Pavel
:
:
:
: --
: View this message in context: http://lucene.472066.n3.nabble.com/Bad-contentType-for-search-handler-text-xml-charset-UTF-8-tp4200314.html
: Sent from the Solr - User mailing list archive at Nabble.com.
:
-Hoss
http://www.lucidworks.com/