Project

General

Profile

Bug #8658

POST no longer works in Solr query endpoint

Added by Dave Vieglais over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
d1_cn_solr_extensions
Target version:
-
Start date:
2018-07-24
Due date:
% Done:

100%

Milestone:
None
Product Version:
*
Story Points:
Sprint:

Description

POST requests to cn.dataone.org/cn/v2/query/solr/ return a 500 error:

curl -X POST -d "q=*:*" "https://cn.dataone.org/cn/v2/query/solr/"
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="error"><str name="msg">Solr requires that request parameters sent using application/x-www-form-urlencoded content-type can be read through the request input stream. Unfortunately, the stream was empty / not available. This may be caused by another servlet filter calling ServletRequest.getParameter*() before SolrDispatchFilter, please remove it.</str><str name="trace">org.apache.solr.common.SolrException: Solr requires that request parameters sent using application/x-www-form-urlencoded content-type can be read through the request input stream. Unfortunately, the stream was empty / not available. This may be caused by another servlet filter calling ServletRequest.getParameter*() before SolrDispatchFilter, please remove it.
    at org.apache.solr.servlet.SolrRequestParsers$FormDataRequestParser.getParameterIncompatibilityException(SolrRequestParsers.java:648)
    at org.apache.solr.servlet.SolrRequestParsers$FormDataRequestParser.parseParamsAndFillStreams(SolrRequestParsers.java:624)
    at org.apache.solr.servlet.SolrRequestParsers$StandardRequestParser.parseParamsAndFillStreams(SolrRequestParsers.java:746)
    at org.apache.solr.servlet.SolrRequestParsers.parse(SolrRequestParsers.java:160)
    at org.apache.solr.servlet.HttpSolrCall.init(HttpSolrCall.java:300)
    at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:412)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:227)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:196)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
    at org.dataone.solr.servlet.SessionAuthorizationUtil.handleNoCertificateManagerSession(SessionAuthorizationUtil.java:131)
    at org.dataone.solr.servlet.SearchServiceSessionAuthorizationFilter.handleNoCertificateManagerSession(SearchServiceSessionAuthorizationFilter.java:45)
    at org.dataone.solr.servlet.SessionAuthorizationFilterStrategy.doFilter(SessionAuthorizationFilterStrategy.java:265)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:497)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:748)
</str><int name="code">500</int></lst>
</response>

Screen Shot 2018-07-27 at 10.55.37 AM.png - SOLR post using `multipart/form-data` (269 KB) Rushiraj Nenuji, 2018-07-27 17:57

670

History

#1 Updated by Jing Tao over 6 years ago

The issue is to use the option "-d". I believe we use the mutipart form data format in our server. So the command should be:
curl -X POST -F "q=*:*" "https://cn.dataone.org/cn/v2/query/solr/"

#2 Updated by Rushiraj Nenuji over 6 years ago

670

So, I tried making solr POST request using multipart/form-data, and it seems that this is working.

Looks like I was using wrong Content type for POST: application/x-www-form-urlencoded

Please find attached a screenshot of working POST request.

#3 Updated by Rushiraj Nenuji over 6 years ago

Rushiraj Nenuji wrote:

So, I tried making solr POST request using multipart/form-data, and it seems that this is working.

Looks like I was using wrong Content type for POST: application/x-www-form-urlencoded

Please find attached a screenshot of working POST request.

I think it is safe to close this ticket.

#4 Updated by Jing Tao over 6 years ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 14.8 MB)