Hi, I'm using an Embedded Tomcat. I want to use the Tomcat's functionality - default context.xml. I'm extending the org.apache.catalina.startup.ContextConfig. Sometimes the default context.xml is outside of the "base" directory, because of this I'm using the following method to set the location - in the java doc it is stated that an absolute path is acceptable for method parameter. http://svn.apache.org/repos/asf/tomcat/tc6.0.x/tags/TOMCAT_6_0_26/java/org/apache/catalina/startup/ContextConfig.java 218 /** 219 * Set the location of the default context file 220 * 221 * @param path Absolute/relative path to the default context.xml 222 */ 223 public void setDefaultContextXml(String path) { 224 225 this.defaultContextXml = path; 226 227 } When ContextConfig.contextConfig() method is invoked, a wrong path is generated for the default context.xml i.e. If the base directory is d:/base-dir and the path to the default context.xml is d:/other-dir/configuration/context.xml the following is generated: d:/base-dir/d:/other-dir/configuration/context.xml This happens in ContextConfig.java: 715 /** 716 * Process the default configuration file, if it exists. 717 */ 718 protected void contextConfig() { ... 728 processContextConfig(new File(getBaseDir()), defaultContextXml); ... 734 } 737 /** 738 * Process a context.xml. 739 */ 740 protected void processContextConfig(File baseDir, String resourceName) { ... 749 File file = baseDir; 750 if (resourceName != null) { 751 file = new File(baseDir, resourceName); 752 } ... 819 } Could you please clarify whether it is possible to use this setter method with absolute paths? Thanks in advance Regards
Thanks for the bug report. I have fixed in this in 7.0.x (it will be in 7.0.1 onwards) and proposed the fix for 6.0.x.
This has been fixed in 6.0.x and will be included in 6.0.29 onwards.