You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2007/04/18 21:28:48 UTC

DO NOT REPLY [Bug 42163] New: - Subfolders taken as applications by Automatic Application Deployment

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42163>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42163

           Summary: Subfolders taken as applications by Automatic
                    Application Deployment
           Product: Tomcat 6
           Version: 6.0.10
          Platform: Other
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: martin@silvermetric.com


This had me stumped for a few hours today...

In server.xml, when a Host has deployOnStartup="true" or autoDeploy="true", it
seems that Tomcat is taking all folders within the appBase to be separate
applications, whether or not they have a WEB-INF/web.xml.  This problem happened
for me when there was only one Context - the application within appBase.  I'm
not sure if it happens when multiple contexts are defined.

So, for example, lets say you have an application with the following in the root
directory:

index.jsp
/subdir
/subdir/index.jsp
/WEB-INF
/WEB-INF/web.xml

There's no problem accessing http://mydomain.com/index.jsp (or any other page
within the main directory).  However, if you try to access
http://mydomain.com/subdir/ or anything within that subdirectory, the request
won't get to your application code, as Tomcat will assume that the request is
for an application deployed in /subdir (an application which doesn't exist). 
I've found one of two things happening:

1.  If the URL doesn't map to a real file e.g. /subdir/madeupURL: Tomcat just
returns a 404 error.
2.  If the URL does map to a real file e.g. /subdir/index.jsp: Tomcat will log a
WARN "Internal Error: File /WEB-INF/web.xml not found", and try to execute the
file at /subdir/index.jsp (in my case failing with a misleading error because
the index.jsp file relies on stuff in the application classpath...).

Basically the problem seems to be that the check for a WEB-INF/web.xml isn't
happening properly.  So subdirectories are getting labelled as applications even
if they don't have a WEB-INF/web.xml.

The workaround is easy: set the Host attributes deployOnStartup="false" and
autoDeploy="false" in server.xml.

Cheers,
Martin

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 42163] - Subfolders taken as applications by Automatic Application Deployment

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42163>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42163





------- Additional Comments From remm@apache.org  2007-04-18 16:05 -------
It should be obvious that there's something wrong if you map somehow harcode
mapping of the host's appBase as the root webapp, and leave autodeployment
enabled. What do you expect to be autodeployed exactly ?

The actual workaround is to not use webapp deployment hacks (Context elements
are still allowed in server.xml due to certain use cases; however I have the
feeling an empty - or equivalent - docBase should be forbidden or at least cause
a very visible warning).

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 42163] - Subfolders taken as applications by Automatic Application Deployment

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42163>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42163





------- Additional Comments From martin@silvermetric.com  2007-04-19 01:59 -------
Mark, my apologies, I hadn't realized that this was in the 2.5 spec.  Updated
docs will make it clearer for anyone else that might be confused by this - thanks.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 42163] - Subfolders taken as applications by Automatic Application Deployment

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42163>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42163





------- Additional Comments From martin@silvermetric.com  2007-04-19 02:39 -------
Remy, you're basically right about the configuration that I was aiming for.  I'm
afraid I don't have a great understanding of the ways in which contexts and
hosts are best configured so most likely I was going about it all the wrong way.

What I was trying to do was to configure contexts outside of server.xml (with
XML files in $CATALINA_HOME/conf/[engine_name]/[host_name]).  The directory
structure on my server doesn't have all the tomcat applications arranged inside
one directory: for this reason all my contexts are defined with an
absolute-pathname docBase, so essentially I didn't want appBase to be used at
all.  But appBase is a required attribute of Host, so I figured that setting it
the same as the docBase of the root context made sense.

So I wanted auto-deployment at startup time to find the context xml files in
$CATALINA_HOME/conf/[engine_name]/[host_name], but *not* to take subdirectories
of appBase as applications.  This worked OK in Tomcat 5, because WEB-INF/web.xml
was actually required for Tomcat 5 to consider a subdirectory of appBase to be
an application.  But, as Mark explained, in Tomcat 6, any directory within
appBase gets defined as an application, meaning that any subdirectory would get
taken as an application.

I guess this might be one of the use-cases that you mention where contexts need
to be defined in server.xml.  Or more likely I'm just a bit confused :s

Anyway, I don't want you to think that I'm treating this bug as a personal
tomcat-configuration tutorial, so please don't feel obliged to correct me!

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 42163] - Subfolders taken as applications by Automatic Application Deployment

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42163>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42163





------- Additional Comments From martin@silvermetric.com  2007-04-19 04:39 -------
Ah, that makes sense - thanks Mark :)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 42163] - Subfolders taken as applications by Automatic Application Deployment

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42163>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42163


markt@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From markt@apache.org  2007-04-18 15:50 -------
This is as required by the 2.5 spec and by design. The automatic deployment docs
have been updated to reflect that a WEB-INF/web.xml file is no longer required
by the spec.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 42163] - Subfolders taken as applications by Automatic Application Deployment

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42163>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42163





------- Additional Comments From markt@apache.org  2007-04-19 04:33 -------
Your fine with one minor correction. Host appBase should never be set to the
same as an apps docBase. Simplest solution - create an empty dir for it.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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