tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jäkel, Guido <G.Jae...@dnb.de>
Subject Followup: Changed behaviour of Tomcat Deployment/Context/Lifecycle Manager concerning symbolic links
Date Fri, 08 Mar 2019 10:39:10 GMT
My investigations so far: This is thrown by

   java/org/apache/catalina/webresources/StandardRoot.java

    protected WebResourceSet createMainResourceSet() {
        String docBase = context.getDocBase();

        WebResourceSet mainResourceSet;
        if (docBase == null) {
            mainResourceSet = new EmptyResourceSet(this);
        } else {
            File f = new File(docBase);
            if (!f.isAbsolute()) {
                f = new File(((Host)context.getParent()).getAppBaseFile(), f.getPath());
            }
            if (f.isDirectory()) {
                mainResourceSet = new DirResourceSet(this, "/", f.getAbsolutePath(), "/");
            } else if(f.isFile() && docBase.endsWith(".war")) {		<<==========
HERE
                mainResourceSet = new WarResourceSet(this, "/", f.getAbsolutePath());
            } else {
                throw new IllegalArgumentException(
                        sm.getString("standardRoot.startInvalidMain",
                                f.getAbsolutePath()));
            }
        }

        return mainResourceSet;



And just from the names of the used methods, I wonder that the root cause is the following
change


	diff -r -u /var/tmp/portage/www-servers/tomcat-8.5.23/work/apache-tomcat-8.5.23-src/java/org/apache/catalina/startup/ContextConfig.java
/var/tmp/portage/www-servers/tomcat-8.5.37/work/apache-tomcat-8.5.37-src/java/org/apache/catalina/startup/ContextConfig.java

	[...]
	@@ -589,7 +583,7 @@
 
         File file = new File(docBase);
         if (!file.isAbsolute()) {
-            docBase = (new File(appBase, docBase)).getPath();
+            docBase = (new File(appBase, docBase)).getCanonicalPath();
         } else {
             docBase = file.getCanonicalPath();
         }
	[...]

(I'm going to check this out right now)

May somebody point me to a ticket for the commit of this change and/or an issue ticket leading
to this change? I want to know the motivation for this change and I want to please to find
a solution to keep the old behavior. Because in my eyes, the current is inconsistent: For
the context naming and so on, the well-known behavior is kept -- the context is named by the
naming of the link itself and not of it's destination. And therefore, this should also hold
for all other aspects


greetings

Guido





>[...]
>for deployment, with the newer Tomcat version I get the error
>
>	20190308-092433.557 ERROR [catalina-exec-38] [] [[/manager]] FAIL - Application at context
path [/foo] could not be
>started
>	org.apache.catalina.LifecycleException: Failed to start component
>[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/foo]]
> [...]
>	Caused by: java.lang.IllegalArgumentException: The main resource set specified
>[/some/fill/path/to/destination/bar.an_extension] is not valid
>	        at org.apache.catalina.webresources.StandardRoot.createMainResourceSet(Unknown
Source)
>	        at org.apache.catalina.webresources.StandardRoot.startInternal(Unknown Source)
>	        ... 39 more

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

Mime
View raw message