I had trouble returning a field from Solr (as detailed in a previous
e-mail) using the built-in Jetty. It worked fine with Tomcat, and I
just tried it with Jetty 5.1.11RC0 and it works as well. It seems
the Jetty version in Solr's repository is an "unstable" version that
has some type of response rendering bug (with use of NIO?) but that
the latest "stable" release works fine.
Are there reasons we need to have an unstable version of Jetty built
into the example app? Or would it be ok to switch to 5.1.11RC0?
In making the downgrade of Jetty, I encountered a web.xml issue and
got this exception with the default web.xml:
09:50:08.053 WARN!! [main]
org.mortbay.jetty.servlet.WebApplicationContext.doStart
(WebApplicationContext.java:519) >12> Configuration error on file:/
Users/erik/jetty-5.1.11RC0/webapps/solr/
org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration
of element 'web-app'.
at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException
(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown
Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError
(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError
(Unknown Source)
at
org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement
(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement
(Unknown Source)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement
(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl
$NSContentDispatcher.scanRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
$FragmentContentDispatcher.dispatch(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse
(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse
(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
at org.mortbay.xml.XmlParser.parse(XmlParser.java:217)
at org.mortbay.xml.XmlParser.parse(XmlParser.java:235)
at org.mortbay.jetty.servlet.XMLConfiguration.configureWebApp
(XMLConfiguration.java:190)
at
org.mortbay.jetty.servlet.WebApplicationContext.configureWebApp
(WebApplicationContext.java:425)
at org.mortbay.jetty.servlet.WebApplicationContext.doStart
(WebApplicationContext.java:478)
at org.mortbay.util.Container.start(Container.java:72)
at org.mortbay.http.HttpServer.doStart(HttpServer.java:708)
at org.mortbay.util.Container.start(Container.java:72)
at org.mortbay.jetty.Server.main(Server.java:460)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.mortbay.start.Main.invokeMain(Main.java:151)
at org.mortbay.start.Main.start(Main.java:476)
at org.mortbay.start.Main.main(Main.java:94)
I modified web.xml to the following and all worked just fine.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://
java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>SolrServer</servlet-name>
<servlet-class>org.apache.solr.servlet.SolrServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet>
<servlet-name>SolrUpdate</servlet-name>
<servlet-class>org.apache.solr.servlet.SolrUpdateServlet</
servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SolrServer</servlet-name>
<url-pattern>/select/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SolrUpdate</servlet-name>
<url-pattern>/update/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ping</servlet-name>
<jsp-file>/admin/ping.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>ping</servlet-name>
<url-pattern>/admin/ping</url-pattern>
</servlet-mapping>
</web-app>
I'd be happy to work on fixing the example to use this version of
Jetty and update web.xml. Any objections?
Erik