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 Andrew Clegg <an...@gmail.com> on 2009/09/29 14:32:41 UTC

Problem getting Solr home from JNDI in Tomcat

Hi all, I'm having problems getting Solr to start on Tomcat 6.

Tomcat is installed in /opt/apache-tomcat , solr is in
/opt/apache-tomcat/webapps/solr , and my Solr home directory is /opt/solr .
My config file is in /opt/solr/conf/solrconfig.xml .

I have a Solr-specific context file in
/opt/apache-tomcat/conf/Catalina/localhost/solr.xml which looks like this:

<Context debug="0" crossContext="true" >
        <Environment name="solr/home" type="java.lang.String"
value="/opt/solr" override="true" />
        <Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="128\.40\.46\..*,127\.0\.0\.1" />
</Context>

But when I start Solr and browse to it, it tells me:

java.lang.RuntimeException: Can't find resource 'solrconfig.xml' in
classpath or 'solr/conf/', cwd=/ at
org.apache.solr.core.SolrResourceLoader.openResource(SolrResourceLoader.java:194)
at
org.apache.solr.core.SolrResourceLoader.openConfig(SolrResourceLoader.java:162)
at org.apache.solr.core.Config.<init>(Config.java:100) at
org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:113) at
org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:70) at
org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:117)
at
org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:69)
at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4356)
at
org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1244)
at
org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:604)
at
org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:129)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.jstripe.tomcat.probe.Tomcat55AgentValve.invoke(Tomcat55AgentValve.java:20)
at
org.jstripe.tomcat.probe.Tomcat55AgentValve.invoke(Tomcat55AgentValve.java:20)
at
org.jstripe.tomcat.probe.Tomcat55AgentValve.invoke(Tomcat55AgentValve.java:20)
at
org.jstripe.tomcat.probe.Tomcat55AgentValve.invoke(Tomcat55AgentValve.java:20)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619) 

Weirdly, the exact same context file works fine on a different machine. I've
tried giving Context a docBase element (both absolute, and relative paths)
but it makes no difference -- Solr still isn't seeing the right home
directory. I also tried setting debug="1" but didn't see any more useful
info anywhere.

Any ideas? This is a total show-stopper for me as this is our production
server. (Otherwise I'd think about taking it down and hardwiring the Solr
home path into the server's context...)

Yours hopefully,

Andrew.

-- 
View this message in context: http://www.nabble.com/Problem-getting-Solr-home-from-JNDI-in-Tomcat-tp25662200p25662200.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Problem getting Solr home from JNDI in Tomcat

Posted by Andrew Clegg <an...@gmail.com>.


Andrew Clegg wrote:
> 
> 
> hossman wrote:
>> 
>> 
>> This is why the examples of using context files on the wiki talk about 
>> keeping the war *outside* of the webapps directory, and using docBase in 
>> your Context declaration...
>>   http://wiki.apache.org/solr/SolrTomcat
>> 
>> 
> 
> Great, I'll try it this way and see if it clears up. Is it okay to keep
> the war file *inside* the Solr home directory (/opt/solr in my case) so
> it's all self-contained?
> 

For the benefit of future searchers -- I tried it this way and it works
fine. Thanks again to everyone for helping.

Andrew.

-- 
View this message in context: http://www.nabble.com/Problem-getting-Solr-home-from-JNDI-in-Tomcat-tp25662200p25701748.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Problem getting Solr home from JNDI in Tomcat

Posted by Andrew Clegg <an...@gmail.com>.

hossman wrote:
> 
> 
> : Hi all, I'm having problems getting Solr to start on Tomcat 6.
> 
> which version of Solr?
> 
> 

Sorry -- a nightly build from about a month ago. Re. your other message, I
was sure the two machines had the same version on, but maybe not -- when I'm
back in the office tomorrow I'll upgrade them both to a fresh nightly.


hossman wrote:
> 
> 
> : Tomcat is installed in /opt/apache-tomcat , solr is in
> : /opt/apache-tomcat/webapps/solr , and my Solr home directory is
> /opt/solr .
> 
> if "solr is in /opt/apache-tomcat/webapps/solr" means that you put the 
> solr.war in /opt/apache-tomcat/webapps/ and tomcat expanded it into  
> /opt/apache-tomcat/webapps/solr then that is your problem -- tomcat isn't 
> even looking at your context file (it only looks at the context files to 
> ersolve URLs that it cant resolve looking in the webapps directory)
> 
> 

Yes, it's auto-expanded from a war in webapps.

I have to admit to being a bit baffled though -- I can't find this rule
anywhere in the Tomcat docs, but I'm a beginner really and they're not the
clearest :-)


hossman wrote:
> 
> 
> This is why the examples of using context files on the wiki talk about 
> keeping the war *outside* of the webapps directory, and using docBase in 
> your Context declaration...
>   http://wiki.apache.org/solr/SolrTomcat
> 
> 

Great, I'll try it this way and see if it clears up. Is it okay to keep the
war file *inside* the Solr home directory (/opt/solr in my case) so it's all
self-contained?

Many thanks,

Andrew.

-- 
View this message in context: http://www.nabble.com/Problem-getting-Solr-home-from-JNDI-in-Tomcat-tp25662200p25677750.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Problem getting Solr home from JNDI in Tomcat

Posted by Chris Hostetter <ho...@fucit.org>.
: Hi all, I'm having problems getting Solr to start on Tomcat 6.

which version of Solr?

: Tomcat is installed in /opt/apache-tomcat , solr is in
: /opt/apache-tomcat/webapps/solr , and my Solr home directory is /opt/solr .

if "solr is in /opt/apache-tomcat/webapps/solr" means that you put the 
solr.war in /opt/apache-tomcat/webapps/ and tomcat expanded it into  
/opt/apache-tomcat/webapps/solr then that is your problem -- tomcat isn't 
even looking at your context file (it only looks at the context files to 
ersolve URLs that it cant resolve looking in the webapps directory)

This is why the examples of using context files on the wiki talk about 
keeping the war *outside* of the webapps directory, and using docBase in 
your Context declaration...
  http://wiki.apache.org/solr/SolrTomcat



-Hoss


Re: Problem getting Solr home from JNDI in Tomcat

Posted by Chris Hostetter <ho...@fucit.org>.
: Now I've got a completely different error:
: "org.apache.lucene.index.CorruptIndexException: Unknown format version: -9".
: I think it might be time for a fresh install...

I've added a FAQ for this...

http://wiki.apache.org/solr/FAQ#What_does_.22CorruptIndexException:_Unknown_format_version.22_mean_.3F

What does "CorruptIndexException: Unknown format version" mean ?

This happens when the Lucene code in Solr used to read the index files 
from disk encounters index files in a format it doesn't recognize.

The most common cause is from using a version of Solr+Lucene that is older 
then the version used to create that index. 


-Hoss


Re: Problem getting Solr home from JNDI in Tomcat

Posted by Andrew Clegg <an...@gmail.com>.

Constantijn Visinescu wrote:
> 
> This might be a bit of a hack but i got this in the web.xml of my
> applicatin
> and it works great.
> 
>     <!-- People who want to hardcode their "Solr Home" directly into the
>        WAR File can set the JNDI property here...
>    -->
>     <env-entry>
>        <env-entry-name>solr/home</env-entry-name>
>        <env-entry-value>/Solr/WebRoot/WEB-INF/solr</env-entry-value>
>        <env-entry-type>java.lang.String</env-entry-type>
>     </env-entry>
> 
> 

That worked, thanks. You're right though, it is a bit of a hack -- I'd
prefer to set the path from *outside* the app so it won't get overwritten
when I upgrade.

Now I've got a completely different error:
"org.apache.lucene.index.CorruptIndexException: Unknown format version: -9".
I think it might be time for a fresh install...

Cheers,

Andrew.



-- 
View this message in context: http://www.nabble.com/Problem-getting-Solr-home-from-JNDI-in-Tomcat-tp25662200p25663931.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Problem getting Solr home from JNDI in Tomcat

Posted by Constantijn Visinescu <ba...@gmail.com>.
This might be a bit of a hack but i got this in the web.xml of my applicatin
and it works great.

    <!-- People who want to hardcode their "Solr Home" directly into the
       WAR File can set the JNDI property here...
   -->
    <env-entry>
       <env-entry-name>solr/home</env-entry-name>
       <env-entry-value>/Solr/WebRoot/WEB-INF/solr</env-entry-value>
       <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>

On Tue, Sep 29, 2009 at 2:32 PM, Andrew Clegg <an...@gmail.com>wrote:

>
> Hi all, I'm having problems getting Solr to start on Tomcat 6.
>
> Tomcat is installed in /opt/apache-tomcat , solr is in
> /opt/apache-tomcat/webapps/solr , and my Solr home directory is /opt/solr .
> My config file is in /opt/solr/conf/solrconfig.xml .
>
> I have a Solr-specific context file in
> /opt/apache-tomcat/conf/Catalina/localhost/solr.xml which looks like this:
>
> <Context debug="0" crossContext="true" >
>        <Environment name="solr/home" type="java.lang.String"
> value="/opt/solr" override="true" />
>        <Valve className="org.apache.catalina.valves.RemoteAddrValve"
> allow="128\.40\.46\..*,127\.0\.0\.1" />
> </Context>
>
> But when I start Solr and browse to it, it tells me:
>
> java.lang.RuntimeException: Can't find resource 'solrconfig.xml' in
> classpath or 'solr/conf/', cwd=/ at
>
> org.apache.solr.core.SolrResourceLoader.openResource(SolrResourceLoader.java:194)
> at
>
> org.apache.solr.core.SolrResourceLoader.openConfig(SolrResourceLoader.java:162)
> at org.apache.solr.core.Config.<init>(Config.java:100) at
> org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:113) at
> org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:70) at
>
> org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:117)
> at
> org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:69)
> at
>
> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
> at
>
> org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
> at
>
> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
> at
>
> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
> at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4356)
> at
> org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1244)
> at
>
> org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:604)
> at
>
> org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:129)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at
>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> at
>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> at
>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
> at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
> at
>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> at
>
> org.jstripe.tomcat.probe.Tomcat55AgentValve.invoke(Tomcat55AgentValve.java:20)
> at
>
> org.jstripe.tomcat.probe.Tomcat55AgentValve.invoke(Tomcat55AgentValve.java:20)
> at
>
> org.jstripe.tomcat.probe.Tomcat55AgentValve.invoke(Tomcat55AgentValve.java:20)
> at
>
> org.jstripe.tomcat.probe.Tomcat55AgentValve.invoke(Tomcat55AgentValve.java:20)
> at
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> at
>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> at
>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> at java.lang.Thread.run(Thread.java:619)
>
> Weirdly, the exact same context file works fine on a different machine.
> I've
> tried giving Context a docBase element (both absolute, and relative paths)
> but it makes no difference -- Solr still isn't seeing the right home
> directory. I also tried setting debug="1" but didn't see any more useful
> info anywhere.
>
> Any ideas? This is a total show-stopper for me as this is our production
> server. (Otherwise I'd think about taking it down and hardwiring the Solr
> home path into the server's context...)
>
> Yours hopefully,
>
> Andrew.
>
> --
> View this message in context:
> http://www.nabble.com/Problem-getting-Solr-home-from-JNDI-in-Tomcat-tp25662200p25662200.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>