lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matthew grisius <matthew.gris...@comcast.net>
Subject potential issue/bug reported by Jetty team? was: Re: Change Solr contextPath =“/“ ?
Date Wed, 16 Nov 2016 17:22:47 GMT
I can now deploy my app that uses Solr via Jetty similar to my previous tomcat/tomee+ stack
war deployment thanks to the Jetty team (Simone Bordet).
It turned out to be very straightforward.
Per his suggestion I commented out the RewriteHandler def and reference in $solr/server/etc/jetty.xml.
Then I add standard servlet or static content at “/“ in server/etc/ dir:

CLJServlet.xml:

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd
<http://www.eclipse.org/jetty/configure_9_0.dtd>">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <!-- set "root context" .e.g. "/" -->
  <Set name="contextPath"><Property name="hostContext" default="/"/></Set>
  <!-- set non-root context, e.g. "/CLJServlet" -->
  <!-- <Set name="contextPath"><Property name="hostContext" default="/CLJServlet"/></Set>
-->
  <Set name="war"><Property name="jetty.base"/>/webapps/CLJServlet</Set>
  <Set name="defaultsDescriptor"><Property name="jetty.base"/>/etc/webdefault.xml</Set>
</Configure>

foo.xml:

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd
<http://www.eclipse.org/jetty/configure_9_0.dtd>">
<Configure class="org.eclipse.jetty.server.handler.ContextHandler">
  <!-- set "root context" .e.g. "/" -->
  <!-- <Set name="contextPath"><Property name="hostContext" default="/"/></Set>
-->
  <!-- set non-root context, e.g. "/foo" -->
  <Set name="contextPath"><Property name="hostContext" default="/foo"/></Set>
  <Set name="resourceBase"><Property name="jetty.home" />/webapps/foo</Set>
  <Set name="handler">
    <New class="org.eclipse.jetty.server.handler.ResourceHandler">
      <!-- nothing required here --> 
    </New>
  </Set>
</Configure>

I did report an interesting Jetty warning that tomcat/tomee+ did not catch for my servlet:
Log4j (org.slf4j.impl.Log4jLoggerFactory) warnings: {/CLJServlet} has uncovered http methods
for path: /

The Jetty team (Jan Bartel) responded back and suggested a fix and suggested that I notify
the Solr team, here is his reply in case it might help Solr Team:

Looks like a little bug on solr.  In jetty 9.1.something we changed the definition of the
webdefault.xml file to avoid the "Uncovered http methods" warning. This is related to the
security-constraint for the TRACE method.  We used to have:

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Disable TRACE</web-resource-name>
      <url-pattern>/</url-pattern>
      <http-method>TRACE</http-method>
    </web-resource-collection>
    <auth-constraint/>
  </security-constraint>

Which meant that according to the servlet spec there were indeed uncovered methods.

So we changed it to this couplet instead:

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Disable TRACE</web-resource-name>
      <url-pattern>/</url-pattern>
      <http-method>TRACE</http-method>
    </web-resource-collection>
    <auth-constraint/>
  </security-constraint>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Enable everything but TRACE</web-resource-name>
      <url-pattern>/</url-pattern>
      <http-method-omission>TRACE</http-method-omission>
    </web-resource-collection>
  </security-constraint>

However, I notice that solr has the old definition in their etc/webdefault.xml file, and they
have chosen to add the extra definition only to the web.xml file of their solr-webapp.

So the easiest thing for you to do is:

1. copy the extra security-constraint into the etc/webdefault.xml file so it applies to all
webapps
2. let solr know :)

> On Nov 7, 2016, at 12:14 PM, matthew grisius <matthew.grisius@comcast.net> wrote:
> 
> I previously asked this question and did not receive any suggestions.
> I also asked on Jetty-Users and one person suggested I ask again here so I thought it
might be worth it to ask again.
> 
> Solr is deployed to “/solr” and is then mapped to “/“, e.g. http://localhost:8983/
<http://localhost:8983/> gets mapped to http://localhost:8983/solr/# <http://localhost:8983/solr/#>.
> I want to put a different servlet at “/“ while preserving Solr functionality at “/solr”.
> The reason for this is that I previously deployed my app with Solr on tomcat/tomee via
war file and now want to use a current Solr release using Solr/Jetty.
> 
> I thought the way to accomplish that was to re-assign  the "root context", e.g. contextPath
=“/“ but cannot find a way to do this with Solr/Jetty.
> 
> My unsuccessful attempts included:
> 
> - edit contexts/solr-jetty-context.xml (contextPath, add resourceBase, etc.)
> - unmap solr rewrite rule to pass thru . . .
> - edit other '/contexts/' . . .
> - edit etc/webdefault.xml . . .
> - bin/solr does not appear to affect "/"
> - org.apache.solr.util.SolrCLI does not appear to affect "/"
> 
> Perhaps I’m not trying the right combination of things in the right order to solve
the issue, but I’ve run out of simple ideas to try.
> 
> Does anyone have any other suggestions?
> Thank you, any help would be appreciated!
> 
> -matt.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message