https://issues.apache.org/bugzilla/show_bug.cgi?id=49551

           Summary: When setting absolute path to default context.xml, in
                    ContextConfig.contextConfig() it cannot be found
           Product: Tomcat 6
           Version: 6.0.26
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: violet...@apache.org


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

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

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

Reply via email to