Friday, September 3, 2010

A docBase inside the host appBase has been specified, and will be ignored

I've literally spent hours trying to debug an issue with my Tomcat deployment.  I have a web application archive (war) in C:\search\solr\topic and a simple context file located at C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost\topic.xml:

<?xml version="1.0" encoding="utf-8"?>
<Context docBase="/search/solr/topic/apache-solr-1.4.1.war" debug="0" crossContext="true">
  <Environment name="solr/home" type="java.lang.String" value="/search/solr/topic/" override="true"/>
</Context>
When I start the application I get the following errors in my log file:


WARNING: A docBase C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\search\solr\savingscom\topic.war inside the host appBase has been specified, and will be ignored
Sep 3, 2010 11:34:41 AM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\topic does not exist or is not a readable directory
    at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:142)
    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4249)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4418)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
    at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
The odd thing is that the same setup is working perfectly on other servers.  After many hours, I finally found out what the issue was.  The problem was completely resolved by making the following change to my context file:

<?xml version="1.0" encoding="utf-8"?>
<Context docBase="c:/search/solr/topic/apache-solr-1.4.1.war" debug="0" crossContext="true">
  <Environment name="solr/home" type="java.lang.String" value="/search/solr/topic/" override="true"/>
</Context>
 I hope this post can save someone as much grief as the issue cause me.

3 comments:

  1. Good Job! This does solve the problem! Thanks very much!!!!

    ReplyDelete
  2. wow, is this your only post? funny, but helped me alot! thanks

    ReplyDelete
  3. Also helped me a lot! An hour wasted trying to work out what was wrong, but it could have been many more without this post.

    ReplyDelete