安装 CKAN 时 Solr 不会在码头启动

Solr doesn't start in jetty while installing CKAN

被要求安装 CKAN,我正在关注 the documented procedure。 该过程提到 Ubuntu 作为 OS,但由于我使用的是 Debian 9,所以我还是选择继续。

我设法在 jetty(9.2.21) 上安装和配置了 solr(3.6.2) 之前的所有东西(包是 "solr-jetty",jetty 可以开始自动绑定到它自己的套接字,因为可以看到根应用程序的测试页面),但是当我启动码头时,会抛出一个 NPE 并跟踪到日志中。

安装会创建一个文件 /etc/jetty9/contexts/solr.xml,内容如下:

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/solr</Set>
  <Set name="war">/usr/share/solr/web</Set>

  <!-- Set the solr.solr.home system property -->
  <Call name="setProperty" class="java.lang.System">
    <Arg type="String">solr.solr.home</Arg>
    <Arg type="String">/usr/share/solr</Arg>
  </Call>

  <!-- Enable symlinks -->
  <Call name="addAliasCheck">
    <Arg>
      <New class="org.eclipse.jetty.server.handler.ContextHandler$ApproveSameSuffixAliases"/>
    </Arg>
  </Call>
</Configure>

我从文件 /etc/jetty9/jetty.conf

中引用
jetty-logging.xml
contexts/solr.xml
jetty-started.xml

似乎正确获取了 solr webapp 的配置文件。此外,属性 solr.solr.home 似乎映射到正确的目录。 但是在启动jetty的时候,在/var/log/jetty9/里面写了如下内容:

2018-05-02 11:51:00.827:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@5afa04c{/,file:/var/lib/jetty9/webapps/root/,AVAILABLE}{/root}
2018-05-02 11:51:00.853:INFO:oejs.ServerConnector:main: Started ServerConnector@41b12eec{HTTP/1.1}{127.0.0.1:8983}
2018-05-02 11:51:00.853:INFO:oejs.Server:main: Started @831ms
2018-05-02 11:51:00.853:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.w.WebAppContext@40ef3420{/solr,null,null}{/usr/share/solr/web}
java.lang.NullPointerException
        at org.eclipse.jetty.webapp.Configuration$ClassList.serverDefault(Configuration.java:131)
        at org.eclipse.jetty.webapp.WebAppContext.loadConfigurations(WebAppContext.java:932)
        at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:435)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:504)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.xml.XmlConfiguration.run(XmlConfiguration.java:1255)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1174)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:321)
        at org.eclipse.jetty.start.Main.start(Main.java:817)
        at org.eclipse.jetty.start.Main.main(Main.java:112)

我就是想不通是什么导致了 NPE。

contexts/solr.xml 不应出现在您的 jetty.conf

应该从 WebAppProvider 扫描配置的目录位置 Jetty 中获取 XML 文件,这是 Jetty 中 DeploymentManager 概念的一部分。

他们现在配置它的方式,你有一个带有根上下文的服务器(从 /var/lib/jetty9/webapps/root/ 部署),以及一个单独的对象,它创建一个未连接的 WebAppContext 未附加到 HandlerCollection,或 Context,甚至 Server

找到 WebAppProvider 引用的 monitoredDirName 目录并确保您的 solr.xml 存在于该目录中。

提示:找到您正在使用的实际码头配置的 start.ini(文件)或 start.d/*.ini(目录 + 文件)。 monitoredDirName 可能在您系统上的这些文件之一中声明。

Lastly, Jetty 9.2.x is EOL (End of Life), consider upgrading.