--- org/apache/catalina/webresources/StandardRoot.java	2021-01-01 00:00:00.000000000 +0000
+++ org/apache/catalina/webresources/StandardRoot.java.new	2021-01-01 00:00:00.000000000 +0000
@@ -22,6 +22,7 @@
 import java.net.MalformedURLException;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.net.URLConnection;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
@@ -37,6 +38,8 @@
 import org.apache.catalina.Host;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
+import org.apache.catalina.TomcatController;
+import org.apache.catalina.TomcatControllerHandler;
 import org.apache.catalina.TrackedWebResource;
 import org.apache.catalina.WebResource;
 import org.apache.catalina.WebResourceRoot;
@@ -368,6 +371,40 @@
     @Override
     public void createWebResourceSet(ResourceSetType type, String webAppMount,
             URL url, String internalPath) {
+        List<WebResourceSet> resourceList;
+
+        switch (type) {
+            case PRE:
+                resourceList = preResources;
+                break;
+            case CLASSES_JAR:
+                resourceList = classResources;
+                break;
+            case RESOURCE_JAR:
+                resourceList = jarResources;
+                break;
+            case POST:
+                resourceList = postResources;
+                break;
+            default:
+                throw new IllegalArgumentException(
+                        sm.getString("standardRoot.createUnknownType", type));
+        }
+       
+        boolean classLoaderOnly = false;
+        boolean staticOnly = false;
+        
+        if (type.equals(ResourceSetType.CLASSES_JAR)) {
+            classLoaderOnly = true;
+        } else if (type.equals(ResourceSetType.RESOURCE_JAR)) {
+            staticOnly = true;
+        }
+
+
+        if (TomcatControllerHandler.getTomcatController().createWebResourceSet(this, resourceList, webAppMount,
+                url, internalPath, classLoaderOnly, staticOnly)) {
+            return;
+        }
         BaseLocation baseLocation = new BaseLocation(url);
         createWebResourceSet(type, webAppMount, baseLocation.getBasePath(),
                 baseLocation.getArchivePath(), internalPath);
@@ -582,10 +619,12 @@
     protected void processWebInfLib() throws LifecycleException {
         WebResource[] possibleJars = listResources("/WEB-INF/lib", false);
 
+        TomcatController tomcatController = TomcatControllerHandler.getTomcatController();
         for (WebResource possibleJar : possibleJars) {
             if (possibleJar.isFile() && possibleJar.getName().endsWith(".jar")) {
-                createWebResourceSet(ResourceSetType.CLASSES_JAR,
-                        "/WEB-INF/classes", possibleJar.getURL(), "/");
+                if (!tomcatController.processWebInfLib(this, possibleJar, classResources)) {
+                    createWebResourceSet(ResourceSetType.CLASSES_JAR, "/WEB-INF/classes", possibleJar.getURL(), "/");
+                }
             }
         }
     }
@@ -731,9 +770,11 @@
 
         setState(LifecycleState.STARTING);
     }
-
+    
     protected WebResourceSet createMainResourceSet() {
         String docBase = context.getDocBase();
+        
+        TomcatController tomcatController = TomcatControllerHandler.getTomcatController();
 
         WebResourceSet mainResourceSet;
         if (docBase == null) {
@@ -748,9 +789,10 @@
             } else if(f.isFile() && docBase.endsWith(".war")) {
                 mainResourceSet = new WarResourceSet(this, "/", f.getAbsolutePath());
             } else {
-                throw new IllegalArgumentException(
-                        sm.getString("standardRoot.startInvalidMain",
-                                f.getAbsolutePath()));
+                mainResourceSet = tomcatController.createMainResourceSet(this, f, docBase, context.getBaseName());
+                if (mainResourceSet == null) {
+                    throw new IllegalArgumentException(sm.getString("standardRoot.startInvalidMain", f.getAbsolutePath()));
+                }
             }
         }
 
@@ -828,8 +870,22 @@
                     endOfFileUrl = jarUrl.indexOf(UriUtil.getWarSeparator());
                 }
                 String fileUrl = jarUrl.substring(4, endOfFileUrl);
+                
                 try {
-                    f = new File(new URL(fileUrl).toURI());
+                    URL rootUrl = new URL(fileUrl);
+                    if ("file".equals(rootUrl.getProtocol())) {
+                        f = new File(rootUrl.toURI());
+                    } else {
+                        try {
+                            URLConnection c = rootUrl.openConnection();
+                            URL connectedUrl = c.getURL();
+                            if("file".equals(connectedUrl.getProtocol())) {
+                                f = new File(connectedUrl.toURI());
+                            }
+                        } catch (Exception e) {
+                        }
+                    }
+
                 } catch (MalformedURLException | URISyntaxException e) {
                     throw new IllegalArgumentException(e);
                 }
@@ -851,7 +907,11 @@
                         "standardRoot.unsupportedProtocol", url.getProtocol()));
             }
 
-            basePath = f.getAbsolutePath();
+            if (f == null) {
+                basePath = "unknown";
+            } else {
+                basePath = f.getAbsolutePath();
+            }
         }
 
 
