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 2006/03/17 14:07:56 UTC

DO NOT REPLY [Bug 39013] New: - Incorrect use of docBase from XML Context file 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=39013>.
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=39013

           Summary: Incorrect use of docBase from XML Context file
                    deployment
           Product: Tomcat 5
           Version: 5.5.16
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: nic.daniau@googlemail.com


I created a folder called "webapps-war" within the Tomcat installation directory
(CATALINA_HOME). The host's default appBase is "webapps" in this directory.

What I wanted to do is use the XML Context file deployment method, i.e. put my
xml file into conf/catalina/localhost (in my case) and specify the docBase to
look for the war in ${catalina.home}/webapps-war/myapp.

But just because the name starts with "webapps", it misinterprets the docBase
setting and I get in tomcat.log:
"A docBase C:\tomcat-5.5.16\webapps-war\myapp inside the host appBase has been
specified, and will be ignored"
and then my deployment fails.

On the other hand, if I name my folder "somethingelse" instead of "webapps-war",
it works like a charm.

So not a big problem (trivial workaround) but would be nicer if the rule was
perfectly implemented. And that would have saved me hours trying to figure out
what was wrong in my deployment!...

If my investigation is correct, the problem can be traced back to
org.apache.catalina.startup.HostConfig and below is my suggested change against
the download from SVN done today (17 March). I'm not an expert on the catalina
source, so it would need another pair of eyes and some testing before you can
say this is the resolution of this problem. The proposed solution is simply to
make sure the string comparaisons includes a trailing "/" after the default appBase.

Questions on the suggested resolution:
I'm not sure in particular if you can use "/" as the directory separator for all
platform of if you'd need to use something like
System.getProperty("file.separator")?
Would there be other places where this applies?
Is there a compelling reason why this can't be done like that?

DIFF FILE against $Revision: 386336 $ $Date: 2006-03-16 14:13:00 +0000 (Thu, 16
Mar 2006) $
Compare:
(<)D:\work-bak\tomcat\container\catalina\src\share\org\apache\catalina\startup\HostConfig.java
(45038 bytes)
   with:
(>)D:\work-bak\tomcat\container\catalina\src\share\org\apache\catalina\startup\HostConfig.java.changed
(44596 bytes)

592c592
<                 if
(!docBase.getCanonicalPath().startsWith(appBase().getAbsolutePath())) {
---
>                 if
(!docBase.getCanonicalPath().startsWith(appBase().getAbsolutePath() + "/")) {
995,996c995,996
<                             if
((current.getAbsolutePath().startsWith(appBase().getAbsolutePath()))
<                                     ||
(current.getAbsolutePath().startsWith(configBase().getAbsolutePath()))) {
---
>                             if
((current.getAbsolutePath().startsWith(appBase().getAbsolutePath() + "/"))
>                                     ||
(current.getAbsolutePath().startsWith(configBase().getAbsolutePath() + "/"))) {
1035,1036c1035,1036
<                         if
((current.getAbsolutePath().startsWith(appBase().getAbsolutePath()))
<                             ||
(current.getAbsolutePath().startsWith(configBase().getAbsolutePath()))) {
---
>                         if
((current.getAbsolutePath().startsWith(appBase().getAbsolutePath() + "/"))
>                             ||
(current.getAbsolutePath().startsWith(configBase().getAbsolutePath() + "/"))) {
1052,1053c1052,1053
<                         if
((current.getAbsolutePath().startsWith(appBase().getAbsolutePath()))
<                             ||
((current.getAbsolutePath().startsWith(configBase().getAbsolutePath())
---
>                         if
((current.getAbsolutePath().startsWith(appBase().getAbsolutePath() + "/"))
>                             ||
((current.getAbsolutePath().startsWith(configBase().getAbsolutePath() + "/")

-- 
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 39013] - Incorrect use of docBase from XML Context file 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=39013>.
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=39013


yoavs@computer.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




-- 
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