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 2019/09/09 11:54:25 UTC
[Bug 63740] New: Host-specific xml files are not processed when
xmlBase is not null
https://bz.apache.org/bugzilla/show_bug.cgi?id=63740
Bug ID: 63740
Summary: Host-specific xml files are not processed when xmlBase
is not null
Product: Tomcat 9
Version: 9.0.24
Hardware: PC
OS: All
Status: NEW
Keywords: PatchAvailable
Severity: normal
Priority: P2
Component: Catalina
Assignee: dev@tomcat.apache.org
Reporter: uk4sx@atlas.cz
Target Milestone: -----
Created attachment 36769
--> https://bz.apache.org/bugzilla/attachment.cgi?id=36769&action=edit
proposed fix
This is a Tomcat 9 - specific bug. Tested with Tomcat 9.0.24. Tomcat 8.5.43
works correctly. Earlier versions not tested.
When using a Host with xmlBase attribute the Host-specific context.xml.default
and web.xml.default files are not processed at all (because they are not
found).
Debugging the problem reveals that Tomcat searches for them in the wrong place:
always in ${catalina.base}/conf/${xmlBase} instead of ${xmlBase} (when xmlBase
is absolute) or ${catalina.base}/${xmlBase} (when xmlBase is relative).
Examples:
for xmlBase="conf/cx" tomcat searches in "${catalina.base}/conf/conf/cx"
but should search in "${catalina.base}/conf/cx"
for xmlBase="H:/myhost" tomcat searches in "${catalina.base}/conf/H:/myhost"
but should search in "H:/myhost"
Workarounds: using symlinks (a nuisance at best) or using Tomcat 8.5.
Analysis: the documentation says that when xmlBase is not specified then
"conf/<engine_name>/<host_name>" will be used as default. However,
Container.getConfigPath() does not prepend "conf/" when xmlBase is null,
and to compensate for this error the (only) 2 callers use
ConfigFileLoader.getSource().getConfResource()
instead of the correct
ConfigFileLoader.getSource().getResource()
This becomes a problem when xmlBase is not null: getConfResouce() prepends
"conf/".
Proposed fix (see attached patch):
- Container.getConfigPath(): prepend "conf/" when xmlBase is null
- ContextConfig.contextConfig() and ContextConfig.getWebXmlSource():
call ConfigFileLoader.getSource().getResource() when working with the result of
Container.getConfigPath()
Proposed fix tested successfully in 3 scenarios:
- no xmlBase: OK
- relative xmlBase: OK
- absolute xmlBase: OK
How to easily test that the fix works:
- for context.xml.default: the log contains (example)
"Successfully processed context [/my-ws] configuration file
[file:/H:/myhost/context.xml.default]"
- for web.xml.default: declare a filter in it with a (unique) nonexistent
className and expect to see a "ClassNotFoundException" with that className
Thanks for fixing this.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 63740] BUG: host-specific xml files are not processed when
xmlBase is not null
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63740
uk4sx@atlas.cz changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |regression
Summary|Host-specific xml files are |BUG: host-specific xml
|not processed when xmlBase |files are not processed
|is not null |when xmlBase is not null
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 63740] Host-specific xml files are not processed when xmlBase
is not null
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63740
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #2 from Mark Thomas <ma...@apache.org> ---
Thanks for the patch and the explanation.
Fixed in:
- master for 9.0.25 onwards
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 63740] Host-specific xml files are not processed when xmlBase
is not null
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63740
--- Comment #1 from uk4sx@atlas.cz ---
Created attachment 36771
--> https://bz.apache.org/bugzilla/attachment.cgi?id=36771&action=edit
additional fix (RewriteValve)
Somehow I missed one callsite of Container.getConfigPath(): it is also used in
RewriteValve. The proposed fix is the same: use getResource() instead of
getConfResource(). Added patch #2.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 63740] Host-specific xml files are not processed when xmlBase
is not null
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63740
Michael Osipov <mi...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|BUG: host-specific xml |Host-specific xml files are
|files are not processed |not processed when xmlBase
|when xmlBase is not null |is not null
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org