1
votes

Being asked to install CKAN, I'm following the documented procedure . The procedure mentions Ubuntu as the OS, but since I'm on Debian 9 I chose to go ahead anyway.

I managed to install and configure pretty much everything up to solr(3.6.2) on jetty(9.2.21) (the packge is "solr-jetty", jetty can start autonomously binding to its own socket, since the test page of the root application can be seen), but an NPE is thrown and traced into the logs when I start jetty.

The installation creates a file /etc/jetty9/contexts/solr.xml with the following contents:

<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>

which I reference from the file /etc/jetty9/jetty.conf

jetty-logging.xml
contexts/solr.xml
jetty-started.xml

The configuration file for the solr webapp seems to be correctly picked up. Also, the property solr.solr.home seems to be mapped to a correct directory. However, when starting jetty, the following content is written in /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$1.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)

I just can't figure out what is causing the NPE.

1

1 Answers

1
votes

contexts/solr.xml should not be in your jetty.conf

That XML file should be picked up from the WebAppProvider that scanning a configured directory location Jetty, which is part of the DeploymentManager concepts within Jetty.

They way you have it configured right now, you have a Server with a root context (deployed from /var/lib/jetty9/webapps/root/), and a separate object that creates an unconnected WebAppContext which isn't attached to a HandlerCollection, or a Context, or even a Server.

Find the monitoredDirName directory referenced by WebAppProvider and make sure your solr.xml is present in that directory.

Tip: locate the start.ini (file) or start.d/*.ini (dir + files) for the actual jetty configuration you are using. The monitoredDirName is likely to be declared in one of those files on your system.

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