You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Barnes, Mark (CORP)" <Ma...@ADP.com> on 2015/01/19 20:52:29 UTC

Tomcat 8.0.14 - Using the Wrong Webapp Directory?


It looks to me like Tomcat 8.0.14 is trying to use the wrong directory when trying to load a web app.

In my server.xml, in my <Host> element, I have name='wapp1_001" and appBase=””.  In my <Context> element, I have path=”/src” and docBase=”webapps/src”

I would expect Tomcat to use $TOMCAT_HOME/webapps/src for the /src context, but it's not.  It's trying to use $TOMCAT_HOME/src.  Why?

Both TOMCAT_HOME and CATALINA_HOME are set to /usr/local/tomcat, which is a symbolic link to /usr/local/tomcat8, which is a symbolic to /usr/local/apache-tomcat-8.0.14.

When I use appBase="/usr/local/tomcat/webapps" things work just fine.  Notice that "webapps" is now in both appBase and docBase.

When I use appBase="webapps" things work just fine as well.  Notice that "webapps" is redundant again.

Buth when I use appBase="" it doesn't work.

The Tomcat 8 configuration docs seem to say that the default for appBase is the "webapps" sub-directory of $TOMCAT_HOME, as it always has been.

I have had this same problem on both Windows 7 and Ubuntu Linux.  JDK is 1.8.0_25 (64-bit) in both cases

Am I missing something here?  Did somethning change between Tomcat 6 and Tomcat 8.  Or is this a bug in Tomcat 8.0.14?




Here is info from the stack traceback:

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat-Standalone].StandardHost[wapp1_001].StandardContext[/src]]
  at java.util.concurrent.FutureTask.report(FutureTask.java:122)
  at java.util.concurrent.FutureTask.get(FutureTask.java:192)
  at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
  at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:868)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat-Standalone].StandardHost[wapp1_001].StandardContext[/src]]
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
  ... 6 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@6672f1f2]
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
  at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4900)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5029)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  ... 6 more
Caused by: java.lang.IllegalArgumentException: The main resource set specified [/usr/local/apache-tomcat-8.0.14/src] is not valid
  at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:665)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  ... 9 more
01-19-2015 14:16:03.524 A child container failed during start



I have submitted a bug report for this.

----------------------------------------------------------------------
This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, notify the sender immediately by return email and delete the message and any attachments from your system.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Tomcat 8.0.14 - Using the Wrong Webapp Directory?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Barnes, Mark (CORP) [mailto:Mark.Barnes@ADP.com] 
> Subject: Tomcat 8.0.14 - Using the Wrong Webapp Directory?

> In my server.xml, in my <Host> element, I have name='wapp1_001" and appBase="".

Does the name attribute match that in the <Engine>, or do you have multiple <Host> elements?  Regardless, the name attribute is meant to be a DNS name; it seems unlikely that "wapp1_001" is that.  Setting appBase to an empty string is rather silly; if it did anything useful at all, it would result in everything in $CATALINA_BASE being treated as a webapp, which is clearly undesirable.  I suppose this is yet another misconfiguration that could be explicitly checked for.

> In my <Context> element, I have path="/src" and docBase="webapps/src"

I'm guessing that your <Context> element is in server.xml, which is pretty much always a bad idea.  It should either be in the webapp's META-INF/context.xml file, or in $CATALINA_BASE/conf/[enginename]/[hostname]/[appName].xml (as clearly stated in the documentation).  When you do put the <Context> element in a more appropriate location, remove the path and docBase attributes, since they are not used when things are set up correctly.

> I would expect Tomcat to use $TOMCAT_HOME/webapps/src for the /src context, but it's not.

The TOMCAT_HOME variable is not used nor recognized by real Tomcat distributions.  If you're using some 3rd-party repackaged version, you'll need to consult their documentation.

> When I use appBase="/usr/local/tomcat/webapps" things work just fine.

Possibly, but you may have a double deployment due to the misconfigured docBase.

> Notice that "webapps" is now in both appBase and docBase.

Which it shouldn't be.  When you correctly place the <Context> element, remove the docBase attribute.

> When I use appBase="webapps" things work just fine as well.

As expected.

> Buth when I use appBase="" it doesn't work.

Good; it shouldn't.

> The Tomcat 8 configuration docs seem to say that the default for appBase is the "webapps" 
> sub-directory of $TOMCAT_HOME, as it always has been.

The doc makes no mention of $TOMCAT_HOME.

> Did somethning change between Tomcat 6 and Tomcat 8.

Lots of things have been tightened up, such that misconfiguration is now more likely to result in explicit errors in the log rather than just doing something unpredictable.  Correct your configuration.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Tomcat 8.0.14 - Using the Wrong Webapp Directory?

Posted by "Barnes, Mark (CORP)" <Ma...@ADP.com>.
This is the response I got to my bug submission:

====================================================================================
(In reply to Mark Barnes from comment #0)

> In my server.xml, in my <Host> element, I have name='wapp1_001" and > appBase=””.

Invalid right off the bat.

> Buth when I use appBase="" it doesn't work.

Nor should it, since that's an invalid configuration.

Bugzilla is not a support forum; post your configuration issues on the Tomcat users' mailing list.

======================================================================================


It works for Tomcat 6 and it worked for Tomcat 5. We're upgrading from 6.0.20 to 8.0.14.

The configuration reference does say this:

The Application Base directory for this virtual host. This is the pathname of a directory that may contain web applications to be deployed on this virtual host. You may specify an absolute pathname, or a pathname that is relative to the $CATALINA_BASE directory. See Automatic Application Deployment for more information on automatic recognition and deployment of web applications. If not specified, the default of webapps will be used.

I get that it does NOT say that appBase="" is the same as not specifying appBase at all. In fact, it doesn't say what appBase="" means. It doesn't say it's invalid, either. So "" is not relative $CATALINA_BASE ???

The Document Base (also known as the Context Root) directory for this web application, or the pathname to the web application archive file (if this web application is being executed directly from the WAR file). You may specify an absolute pathname for this directory or WAR file, or a pathname that is relative to the appBase directory of the owning Host. The value of this field must not be set unless the Context element is defined in server.xml or the docBase is not located under the Host's appBase. If a symbolic link is used for docBase then changes to the symbolic link will only be effective after a Tomcat restart or by undeploying and redeploying the context. A context reload is not sufficient.

Oh, well...

> -----Original Message-----
> From: Barnes, Mark (CORP) [mailto:Mark.Barnes@ADP.com]
> Sent: Monday, January 19, 2015 2:52 PM
> To: Tomcat Users List
> Subject: Tomcat 8.0.14 - Using the Wrong Webapp Directory?
> 
> 
> 
> It looks to me like Tomcat 8.0.14 is trying to use the wrong directory when
> trying to load a web app.
> 
> In my server.xml, in my <Host> element, I have name='wapp1_001" and
> appBase=””.  In my <Context> element, I have path=”/src” and
> docBase=”webapps/src”
> 
> I would expect Tomcat to use $TOMCAT_HOME/webapps/src for the /src
> context, but it's not.  It's trying to use $TOMCAT_HOME/src.  Why?
> 
> Both TOMCAT_HOME and CATALINA_HOME are set to /usr/local/tomcat,
> which is a symbolic link to /usr/local/tomcat8, which is a symbolic to
> /usr/local/apache-tomcat-8.0.14.
> 
> When I use appBase="/usr/local/tomcat/webapps" things work just fine.  Notice
> that "webapps" is now in both appBase and docBase.
> 
> When I use appBase="webapps" things work just fine as well.  Notice that
> "webapps" is redundant again.
> 
> Buth when I use appBase="" it doesn't work.
> 
> The Tomcat 8 configuration docs seem to say that the default for appBase is
> the "webapps" sub-directory of $TOMCAT_HOME, as it always has been.
> 
> I have had this same problem on both Windows 7 and Ubuntu Linux.  JDK is
> 1.8.0_25 (64-bit) in both cases
> 
> Am I missing something here?  Did somethning change between Tomcat 6 and
> Tomcat 8.  Or is this a bug in Tomcat 8.0.14?
> 
> 
> 
> 
> Here is info from the stack traceback:
> 
> java.util.concurrent.ExecutionException:
> org.apache.catalina.LifecycleException: Failed to start component
> [StandardEngine[Tomcat-
> Standalone].StandardHost[wapp1_001].StandardContext[/src]]
>   at java.util.concurrent.FutureTask.report(FutureTask.java:122)
>   at java.util.concurrent.FutureTask.get(FutureTask.java:192)
>   at
> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
>   at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:868)
>   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>   at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:140
> 8)
>   at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:139
> 8)
>   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>   at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1
> 142)
>   at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:
> 617)
>   at java.lang.Thread.run(Thread.java:745)
> Caused by: org.apache.catalina.LifecycleException: Failed to start component
> [StandardEngine[Tomcat-
> Standalone].StandardHost[wapp1_001].StandardContext[/src]]
>   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
>   ... 6 more
> Caused by: org.apache.catalina.LifecycleException: Failed to start component
> [org.apache.catalina.webresources.StandardRoot@6672f1f2]
>   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
>   at
> org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java
> :4900)
>   at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5
> 029)
>   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>   ... 6 more
> Caused by: java.lang.IllegalArgumentException: The main resource set
> specified [/usr/local/apache-tomcat-8.0.14/src] is not valid
>   at
> org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.jav
> a:665)
>   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>   ... 9 more
> 01-19-2015 14:16:03.524 A child container failed during start
> 
> 
> 
> I have submitted a bug report for this.
> 
> ----------------------------------------------------------------------
> This message and any attachments are intended only for the use of the
> addressee and may contain information that is privileged and confidential. If
> the reader of the message is not the intended recipient or an authorized
> representative of the intended recipient, you are hereby notified that any
> dissemination of this communication is strictly prohibited. If you have received
> this communication in error, notify the sender immediately by return email and
> delete the message and any attachments from your system.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


----------------------------------------------------------------------
This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, notify the sender immediately by return email and delete the message and any attachments from your system.