You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Charlie Jackson <Ch...@cision.com> on 2007/05/01 19:01:31 UTC

NullPointerException (not schema related)

Hello,

 

I'm evaluating solr for potential use in an application I'm working on,
and it sounds like a really great fit. I'm having trouble getting the
Collection Distribution part set up, though. Initially, I had problems
setting up the postCommit listener. I first used this xml to configure
the listener:

 

    <listener event="postCommit" class="solr.RunExecutableListener">

      <str name="exe">snapshooter</str>

      <str name="dir">/usr/local/Production/solr/solr/bin/</str>

      <bool name="wait">true</bool>

    </listener>

 

This is what came in the solrconfig.xml file with just a minor tweak to
the directory. However, when I committed data to the index, I was
getting "No such file or directory" errors from the Runtime.exec call. I
verified all of the permissions, etc, with the user I was trying to use.
In the end, I wrote up a little test program to see if it was a problem
with the Runtime.exec call and I think it is. I'm running this on CentOS
4.4 and Runtime.exec seems to have a hard time directly executing bash
scripts. For example, if I called Runtime.exec with a command of
"test_program" (which is a bash script), it failed. If I called
Runtime.exec with a command of "/bin/bash test_program" it worked. 

 

So, with this knowledge in hand, I modified the solrconfig.xml file
again to this:

    <listener event="postCommit" class="solr.RunExecutableListener">

      <str name="exe">/bin/bash</str>

      <str name="dir">/usr/local/Production/solr/solr/bin/</str>

      <bool name="wait">true</bool>

      <str name="args"> <str>snapshooter</str> </str>

    </listener>

 

When I commit data now, however, I get a NullPointerException. I'm
including the stack trace here:

SEVERE: java.lang.NullPointerException

    at org.apache.solr.core.SolrCore.update(SolrCore.java:716)

    at
org.apache.solr.servlet.SolrUpdateServlet.doPost(SolrUpdateServlet.java:
53)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:269)

    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:188)

    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:210)

    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:174)

    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:127)

    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:117)

    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:108)

    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
51)

    at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:87
0)

    at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc
essConnection(Http11BaseProtocol.java:665)

    at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
.java:528)

    at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow
erWorkerThread.java:81)

    at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:685)

    at java.lang.Thread.run(Thread.java:619)

 

I know this has something to do with my config change (the problem goes
away if I turn off the postCommit listener) but I don't know what!

 

BTW I'm using solr-1.1.0-incubating. 

 

Thanks in advance for any help!

 

Charlie

 


Re: NullPointerException (not schema related)

Posted by Mike Klaas <mi...@gmail.com>.
On 5/1/07, Charlie Jackson <Ch...@cision.com> wrote:
> This is what came in the solrconfig.xml file with just a minor tweak to
> the directory. However, when I committed data to the index, I was
> getting "No such file or directory" errors from the Runtime.exec call. I
> verified all of the permissions, etc, with the user I was trying to use.
> In the end, I wrote up a little test program to see if it was a problem
> with the Runtime.exec call and I think it is. I'm running this on CentOS
> 4.4 and Runtime.exec seems to have a hard time directly executing bash
> scripts. For example, if I called Runtime.exec with a command of
> "test_program" (which is a bash script), it failed. If I called
> Runtime.exec with a command of "/bin/bash test_program" it worked.

Yes, Runtime.exec does not invoke a shell automatically, so shebang
lines, shell built-ins, io redirection, etc. cannot be used directly.

-Mike

RE: NullPointerException (not schema related)

Posted by Charlie Jackson <Ch...@cision.com>.
I went with the first approach which got me up and running. Your other
example config (using ./snapshooter) made me realize how foolish my
original problem was!

Anyway, I've got the whole thing up and running and it looks pretty
awesome! 

One quick question, though. As stated in the wiki, one of the benefits
of distributing the indexes is load balance the queries. Is there a
built-in solr mechanism for performing this query load balancing? I'm
suspecting there is not, and I haven't seen anything about it in the
wiki, but I wanted to check because I know I'm going to be asked.

Thanks,
Charlie

-----Original Message-----
From: Chris Hostetter [mailto:hossman_lucene@fucit.org] 
Sent: Tuesday, May 01, 2007 3:20 PM
To: solr-user@lucene.apache.org
Subject: RE: NullPointerException (not schema related)


:     <listener event="postCommit" class="solr.RunExecutableListener">
:       <str name="exe">snapshooter</str>
:       <str name="dir">/usr/local/Production/solr/solr/bin/</str>
:       <bool name="wait">true</bool>
:     </listener>

: the directory. However, when I committed data to the index, I was
: getting "No such file or directory" errors from the Runtime.exec call.
I
: verified all of the permissions, etc, with the user I was trying to
use.
: In the end, I wrote up a little test program to see if it was a
problem
: with the Runtime.exec call and I think it is. I'm running this on
CentOS
: 4.4 and Runtime.exec seems to have a hard time directly executing bash
: scripts. For example, if I called Runtime.exec with a command of
: "test_program" (which is a bash script), it failed. If I called
: Runtime.exec with a command of "/bin/bash test_program" it worked.

this initial problem you were having may be a result of path issues.
dir
doesn't need to be the directory where your script lives, it's the
directory where you wnat your script to run (the "cwd" of the process).
it's possible that the error you were getting was because "." isn't in
the
PATH that was being used, you should try something like this...

     <listener event="postCommit" class="solr.RunExecutableListener">
       <str
name="exe">/usr/local/Production/solr/solr/bin/snapshooter</str>
       <str name="dir">/usr/local/Production/solr/solr/bin/</str>
       <bool name="wait">true</bool>
     </listener>

...or maybe even...

     <listener event="postCommit" class="solr.RunExecutableListener">
       <str name="exe">./snapshooter</str> <!-- note the ./ -->
       <str name="dir">/usr/local/Production/solr/solr/bin/</str>
       <bool name="wait">true</bool>
     </listener>

-Hoss


RE: NullPointerException (not schema related)

Posted by Chris Hostetter <ho...@fucit.org>.
:     <listener event="postCommit" class="solr.RunExecutableListener">
:       <str name="exe">snapshooter</str>
:       <str name="dir">/usr/local/Production/solr/solr/bin/</str>
:       <bool name="wait">true</bool>
:     </listener>

: the directory. However, when I committed data to the index, I was
: getting "No such file or directory" errors from the Runtime.exec call. I
: verified all of the permissions, etc, with the user I was trying to use.
: In the end, I wrote up a little test program to see if it was a problem
: with the Runtime.exec call and I think it is. I'm running this on CentOS
: 4.4 and Runtime.exec seems to have a hard time directly executing bash
: scripts. For example, if I called Runtime.exec with a command of
: "test_program" (which is a bash script), it failed. If I called
: Runtime.exec with a command of "/bin/bash test_program" it worked.

this initial problem you were having may be a result of path issues.  dir
doesn't need to be the directory where your script lives, it's the
directory where you wnat your script to run (the "cwd" of the process).
it's possible that the error you were getting was because "." isn't in the
PATH that was being used, you should try something like this...

     <listener event="postCommit" class="solr.RunExecutableListener">
       <str name="exe">/usr/local/Production/solr/solr/bin/snapshooter</str>
       <str name="dir">/usr/local/Production/solr/solr/bin/</str>
       <bool name="wait">true</bool>
     </listener>

...or maybe even...

     <listener event="postCommit" class="solr.RunExecutableListener">
       <str name="exe">./snapshooter</str> <!-- note the ./ -->
       <str name="dir">/usr/local/Production/solr/solr/bin/</str>
       <bool name="wait">true</bool>
     </listener>

-Hoss


RE: NullPointerException (not schema related)

Posted by Charlie Jackson <Ch...@cision.com>.
Nevermind this...looks like my problem was tagging the "args" as an
<str> node instead of an <arr> node. Thanks anyway!

Charlie

-----Original Message-----
From: Charlie Jackson [mailto:Charlie.Jackson@cision.com] 
Sent: Tuesday, May 01, 2007 12:02 PM
To: solr-user@lucene.apache.org
Subject: NullPointerException (not schema related)

Hello,

 

I'm evaluating solr for potential use in an application I'm working on,
and it sounds like a really great fit. I'm having trouble getting the
Collection Distribution part set up, though. Initially, I had problems
setting up the postCommit listener. I first used this xml to configure
the listener:

 

    <listener event="postCommit" class="solr.RunExecutableListener">

      <str name="exe">snapshooter</str>

      <str name="dir">/usr/local/Production/solr/solr/bin/</str>

      <bool name="wait">true</bool>

    </listener>

 

This is what came in the solrconfig.xml file with just a minor tweak to
the directory. However, when I committed data to the index, I was
getting "No such file or directory" errors from the Runtime.exec call. I
verified all of the permissions, etc, with the user I was trying to use.
In the end, I wrote up a little test program to see if it was a problem
with the Runtime.exec call and I think it is. I'm running this on CentOS
4.4 and Runtime.exec seems to have a hard time directly executing bash
scripts. For example, if I called Runtime.exec with a command of
"test_program" (which is a bash script), it failed. If I called
Runtime.exec with a command of "/bin/bash test_program" it worked. 

 

So, with this knowledge in hand, I modified the solrconfig.xml file
again to this:

    <listener event="postCommit" class="solr.RunExecutableListener">

      <str name="exe">/bin/bash</str>

      <str name="dir">/usr/local/Production/solr/solr/bin/</str>

      <bool name="wait">true</bool>

      <str name="args"> <str>snapshooter</str> </str>

    </listener>

 

When I commit data now, however, I get a NullPointerException. I'm
including the stack trace here:

SEVERE: java.lang.NullPointerException

    at org.apache.solr.core.SolrCore.update(SolrCore.java:716)

    at
org.apache.solr.servlet.SolrUpdateServlet.doPost(SolrUpdateServlet.java:
53)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:269)

    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:188)

    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:210)

    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:174)

    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:127)

    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:117)

    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:108)

    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
51)

    at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:87
0)

    at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc
essConnection(Http11BaseProtocol.java:665)

    at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
.java:528)

    at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow
erWorkerThread.java:81)

    at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:685)

    at java.lang.Thread.run(Thread.java:619)

 

I know this has something to do with my config change (the problem goes
away if I turn off the postCommit listener) but I don't know what!

 

BTW I'm using solr-1.1.0-incubating. 

 

Thanks in advance for any help!

 

Charlie