Hi Folks,

I have a problem with an additional servlet filter defined in my web.xml (Tomcat 7.x). In Solr 4.2.1. we've successfully used a filter for processing POST request data (basically, the filter reads the POST data, collects some parameters from it and writes it back to the request, based on this example: http://www.coderanch.com/t/484631/Tomcat/configure-Tomcat-log-POST-data) To make this work, the filter has to be the first one defined in the web.xml.

But now in Solr 4.8.0, if we define that filter, Solr complains that there is a filter before it and claims that we have to remove it:

null: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:622)

Here is my web.xml:
<!-- My own filter here... -->
 <filter>
<filter-name>post-data-dumper-filter</filter-name>
<filter-class>filters.PostDataDumperFilter</filter-class>
  </filter>
  <filter-mapping>
<filter-name>post-data-dumper-filter</filter-name>
        <url-pattern>/*</url-pattern>
  </filter-mapping>

<!-- Any path (name) registered in solrconfig.xml will be sent to that filter -->
  <filter>
    <filter-name>SolrRequestFilter</filter-name>
<filter-class>org.apache.solr.servlet.SolrDispatchFilter</filter-class>
 </filter>
  <filter-mapping>
    <filter-name>SolrRequestFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

Any idea how to solve this? Why does Solr have a problem now if there is any pre-filter defined?

Thanks a lot,
Stefan

Reply via email to