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 Teruhiko Kurosaka <Ku...@basistech.com> on 2007/05/08 20:53:14 UTC

cwd requirement to run Solr with Tomcat

I struggled to run Solr in Tomcat 5.5 (or 6.0 for that matter).
Then I found a step-by-step instruction at
http://wiki.apache.org/solr/SolrTomcat
and followed it as much as possible (wget URL didn't work, so
I had to download using browser).  Then Solr worked.

An important factor in the instruction is that Tomcat must 
be started from the directory under which the solr directory
(copied from the exmaple) exists. That is, Solr runs only
if Tomcat is invoked as:
$ ./apache-tomcat-5.5.20/bin/startup.sh
It doesn't if Tomcat is invoked like this:
$ cd ./apache-tomcat-5.5.20/bin
$ startup.sh

Where is this restriction come from? This restriction
seems problematic because solr can't be run with
another webapp with a similar restriction in the
same app server. Has anybody explored to get rid of 
this restriction?

Another thing I don't understand is why Tomcat shows
NoClassDefFoundError when the solr directory cannot
be found in the current working directory. There is no
class files or jar files under the solr directory, so I don't
understand why putting the solr directory can remove 
this NoClassDefFoundError. (I wasted good hours trying
to figure out what classes are missing and why.)

-kuro

Re: cwd requirement to run Solr with Tomcat

Posted by James liu <li...@gmail.com>.
i use freebsd(csh),,and use cmd like

> /tmp/*tomcat*/bin/startup.sh
>

if u use

> ./apache-tomcat-5.5.20/bin/startup.sh


u maybe

> chmod +x ./*tomcat*/bin/startup.sh


or

> sh ./*tomcat*/bin/startup.sh



i have 15 instances in one box(use tomcat)





2007/5/9, Teruhiko Kurosaka <Ku...@basistech.com>:
>
>
> > did you try searching for that error message? the first
> > result google gave
> > me points to this mailing list thread...
> >
> > http://mail-archives.apache.org/mod_mbox/tomcat-dev/200512.mbo
> > x/%3c20051219211047.GA32142@easy.in-chemnitz.de%3e
> >
>
> Yes, I found this email archive thread in another mail archive site.
> I tried nuking appBase but that didn't solve the obscure exception,
> and I sent my question thinking maybe this is something unique to
> Solr.   I guess not.
>
> -kuro
>



-- 
regards
jl

RE: cwd requirement to run Solr with Tomcat

Posted by Teruhiko Kurosaka <Ku...@basistech.com>.
> did you try searching for that error message? the first 
> result google gave
> me points to this mailing list thread...
> 
> http://mail-archives.apache.org/mod_mbox/tomcat-dev/200512.mbo
> x/%3c20051219211047.GA32142@easy.in-chemnitz.de%3e
> 

Yes, I found this email archive thread in another mail archive site.
I tried nuking appBase but that didn't solve the obscure exception, 
and I sent my question thinking maybe this is something unique to
Solr.   I guess not.

-kuro

RE: cwd requirement to run Solr with Tomcat

Posted by Chris Hostetter <ho...@fucit.org>.
that section was never really intented to be *the* set of instructions for
installing Solr on Tomcat, just the *simplest* set of things you could do
to see it working, many additional things could be done (besides deleting
the unzipped dir).  If we start listing more things, people may get
confused as assume those things *have* to be done.

I've added some better comments to try and clarify that it's a "minimal"
set of steps.

: The Simple Example Install section in
: http://wiki.apache.org/solr/SolrTomcat
: leaves the unzipped directory apache-solr-nightly-incubating
: intact, but this is not needed after copying the
: solr.war and the example solr directory, is it?
: Can I edit the instruction to insert:
: rm -r apache-solr-nightly-incubating
: after the cp line?




-Hoss


Re: cwd requirement to run Solr with Tomcat

Posted by James liu <li...@gmail.com>.
I don't know simeple example.

i use rename dist/apache*.war as solr.war
and only use example/solr directory

and define it with

http://wiki.apache.org/solr/SolrTomcat
> Multiple Solr Webapps


2007/5/11, Teruhiko Kurosaka <Ku...@basistech.com>:
>
> BTW,
> The Simple Example Install section in
> http://wiki.apache.org/solr/SolrTomcat
> leaves the unzipped directory apache-solr-nightly-incubating
> intact, but this is not needed after copying the
> solr.war and the example solr directory, is it?
> Can I edit the instruction to insert:
> rm -r apache-solr-nightly-incubating
> after the cp line?
>
> -kuro
>



-- 
regards
jl

RE: cwd requirement to run Solr with Tomcat

Posted by Teruhiko Kurosaka <Ku...@basistech.com>.
BTW,
The Simple Example Install section in 
http://wiki.apache.org/solr/SolrTomcat
leaves the unzipped directory apache-solr-nightly-incubating
intact, but this is not needed after copying the
solr.war and the example solr directory, is it?
Can I edit the instruction to insert:
rm -r apache-solr-nightly-incubating
after the cp line?

-kuro

RE: cwd requirement to run Solr with Tomcat

Posted by Chris Hostetter <ho...@fucit.org>.
: Tomcat seems to have changed the way to configure things, starting
: with 5.5. If I follow the instruction given in the "Configuraing Solr
: Home
: with JNDI" section in
: > 	http://wiki.apache.org/solr/SolrTomcat
:
: Tomat ignores it with this warning message in the log:
: WARNING: A docBase /home/kuro/solr-tomcat/tomcat-5.5.23/webapps/solr.war
: inside the host appBase has been specified, and will be ignored

did you try searching for that error message? the first result google gave
me points to this mailing list thread...

http://mail-archives.apache.org/mod_mbox/tomcat-dev/200512.mbox/%3c20051219211047.GA32142@easy.in-chemnitz.de%3e

...which indicates thatthis is what Tomcat says when you are refrencing
the same path in two places ... probably because you have an appBase
configured to server everything in the webapps directory and you've got
hte explicit Context fragment.  The thread suggests that you should put
the war somplace else (or get rid of the appBase).

: >  cna you suggest any ways to make hte documentation more clear? .
:
: I'd simply add another sentence at the end of Simpe Example Install:
:   ... by default. If you would like to run startup.sh from somewhere
: else, specify the solr home as described in the next section.

well it's a wiki, so in the future if you think there are improvements to
be made please feel free to make them, but i went ahead and added
something similar to what you suggested.  thanks for the feedback.


-Hoss


RE: cwd requirement to run Solr with Tomcat

Posted by Teruhiko Kurosaka <Ku...@basistech.com>.
Thank you, Hoss, for replying m question.

> : An important factor in the instruction is that Tomcat must
> : be started from the directory under which the solr directory
> : (copied from the exmaple) exists....

> that's not true.  if you use JNDI or system properties to 
> configure the
> "solr home", then the working directory for Tomcat can be anything you
> want. 
...

That's another thing I ma having problem with.

Tomcat seems to have changed the way to configure things, starting
with 5.5. If I follow the instruction given in the "Configuraing Solr
Home
with JNDI" section in
> 	http://wiki.apache.org/solr/SolrTomcat

Tomat ignores it with this warning message in the log:
WARNING: A docBase /home/kuro/solr-tomcat/tomcat-5.5.23/webapps/solr.war
inside the host appBase has been specified, and will be ignored


>  cna you suggest any ways to make hte documentation more clear? .

I'd simply add another sentence at the end of Simpe Example Install: 
  ... by default. If you would like to run startup.sh from somewhere
else, specify the solr home as described in the next section.

-kuro

Re: cwd requirement to run Solr with Tomcat

Posted by Chris Hostetter <ho...@fucit.org>.
: An important factor in the instruction is that Tomcat must
: be started from the directory under which the solr directory
: (copied from the exmaple) exists. That is, Solr runs only
: if Tomcat is invoked as:
: $ ./apache-tomcat-5.5.20/bin/startup.sh
: It doesn't if Tomcat is invoked like this:
: $ cd ./apache-tomcat-5.5.20/bin
: $ startup.sh

that's not true.  if you use JNDI or system properties to configure the
"solr home", then the working directory for Tomcat can be anything you
want.  Solr only relies on the working directory as a fall back in the
absense of any other information about hwre it can find it's
configuration.

this is discussed at some length in the wikis on seting up solr for
Tomcat, cna you suggest any ways to make hte documentation more clear? ...

	http://wiki.apache.org/solr/SolrInstall
	http://wiki.apache.org/solr/SolrTomcat

: Another thing I don't understand is why Tomcat shows
: NoClassDefFoundError when the solr directory cannot
: be found in the current working directory. There is no

I suspect your were mislead by a situation in which multiple exceptions
were being logged.  The SolrCore class will attempt to find it's
configuration, if it can not, it will throw an exception to that affect
which will be logged ... since it can't find it's configs the SolrCore
class will fail to load, which may then (aparently) cause Tomcat
to also log a NoClassDefFoundError.  (I haven't tested this myself,
recently, i'm taking your word for it that's the error Tomcat produces)

The key to remember is that you have to "debug in order" start with teh
first error/warning/exception that is logged and look at it -- it may
frequently be the cause of other subsequent errors/warnings/exceptions.



-Hoss