bug 448004: Implement changes in the web application creation functionality. Use the new File API.
diff --git a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/ExtendedStandardContext.java b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/ExtendedStandardContext.java
index 063f80d..f1d5691 100644
--- a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/ExtendedStandardContext.java
+++ b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/ExtendedStandardContext.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014 SAP AG
+ * Copyright (c) 2014, 2015 SAP SE
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -16,7 +16,6 @@
 
 package org.eclipse.gemini.web.tomcat.internal;
 
-import java.io.File;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -28,30 +27,20 @@
 
 /**
  * Extends the Tomcat {@link StandardContext} to add custom functionality.
- * 
- * 
+ *
+ *
  */
-public class ExtendedStandardContext extends StandardContext {
+class ExtendedStandardContext extends StandardContext {
 
     private final static Logger LOGGER = LoggerFactory.getLogger(ExtendedStandardContext.class);
 
     private final Bundle bundle;
 
-    public ExtendedStandardContext(Bundle bundle) {
+    ExtendedStandardContext(Bundle bundle) {
         super();
         this.bundle = bundle;
     }
 
-    /**
-     * Returns <code>true</code> for exploded bundles.
-     */
-    @Override
-    public boolean isFilesystemBased() {
-        String docBase = getDocBase();
-        File f = new File(docBase);
-        return f.isDirectory();
-    }
-
     @Override
     public synchronized void reload() {
         if (!getState().isAvailable()) {
diff --git a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/OsgiAwareEmbeddedTomcat.java b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/OsgiAwareEmbeddedTomcat.java
index eabe0a5..b8f2217 100644
--- a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/OsgiAwareEmbeddedTomcat.java
+++ b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/OsgiAwareEmbeddedTomcat.java
@@ -3,12 +3,12 @@
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution. 
+ * and Apache License v2.0 which accompanies this distribution.
  * The Eclipse Public License is available at
  *   http://www.eclipse.org/legal/epl-v10.html
- * and the Apache License v2.0 is available at 
+ * and the Apache License v2.0 is available at
  *   http://www.opensource.org/licenses/apache2.0.php.
- * You may elect to redistribute this code under either of these licenses.  
+ * You may elect to redistribute this code under either of these licenses.
  *
  * Contributors:
  *   VMware Inc. - initial contribution
@@ -47,12 +47,13 @@
 import org.apache.catalina.core.StandardContext;
 import org.apache.catalina.startup.Catalina;
 import org.apache.catalina.startup.ContextConfig;
+import org.apache.catalina.startup.Tomcat;
 import org.apache.naming.java.javaURLContextFactory;
 import org.apache.tomcat.JarScanner;
 import org.apache.tomcat.util.digester.Digester;
 import org.apache.tomcat.util.scan.StandardJarScanner;
 import org.eclipse.gemini.web.core.spi.ServletContainerException;
-import org.eclipse.gemini.web.tomcat.internal.loading.ChainedClassLoader;
+import org.eclipse.gemini.web.tomcat.internal.loader.ChainedClassLoader;
 import org.eclipse.gemini.web.tomcat.internal.support.BundleFileResolverFactory;
 import org.eclipse.gemini.web.tomcat.internal.support.PackageAdminBundleDependencyDeterminer;
 import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
@@ -63,7 +64,7 @@
 import org.slf4j.LoggerFactory;
 import org.xml.sax.SAXException;
 
-public final class OsgiAwareEmbeddedTomcat extends org.apache.catalina.startup.Tomcat {
+public final class OsgiAwareEmbeddedTomcat extends Tomcat {
 
     private static final String USER_DIR = "user.dir";
 
@@ -91,7 +92,7 @@
 
     private final BundleContext bundleContext;
 
-    private File configDir;
+    private Path configDir;
 
     private String defaultContextXml;
 
@@ -104,7 +105,7 @@
     /**
      * Custom mappings of login methods to authenticators
      */
-    protected volatile HashMap<String, Authenticator> authenticators;
+    private volatile HashMap<String, Authenticator> authenticators;
 
     private final Object monitor = new Object();
 
@@ -116,6 +117,8 @@
 
     private final JarScanner defaultJarScanner;
 
+    private String hostConfigDir;
+
     OsgiAwareEmbeddedTomcat(BundleContext context) {
         this.bundleContext = context;
         this.bundleDependenciesJarScanner = new BundleDependenciesJarScanner(new PackageAdminBundleDependencyDeterminer(),
@@ -126,7 +129,7 @@
 
     /**
      * Start the server.
-     * 
+     *
      * @throws LifecycleException
      */
     @Override
@@ -244,20 +247,19 @@
         return addWebapp(path, docBase, null);
     }
 
-    public Context addWebapp(String path, String docBase, Bundle bundle) {
+    Context addWebapp(String path, String docBase, Bundle bundle) {
         if (LOGGER.isDebugEnabled()) {
-            LOGGER.debug("Creating context '" + path + "' with docBase '" + docBase + "'");
+            LOGGER.debug("Creating context [" + path + "] with docBase [" + docBase + "].");
         }
 
         StandardContext context = new ExtendedStandardContext(bundle);
 
-        ExtendedContextConfig config = new ExtendedContextConfig();
+        ContextConfig config = new ExtendedContextConfig();
 
         if (this.configDir == null) {
             // Allocate the tomcat's configuration directory
             this.configDir = TomcatConfigLocator.resolveConfigDir(this.bundleContext);
         }
-        config.setConfigBase(this.configDir);
 
         if (this.defaultWeb == null) {
             // Allocate the default web.xml
@@ -269,21 +271,30 @@
         if (this.defaultContextXml == null) {
             this.defaultContextXml = WebappConfigLocator.resolveDefaultContextXml(this.configDir);
         }
-        config.setDefaultContextXml(this.defaultContextXml);
+        context.setDefaultContextXml(this.defaultContextXml);
+
+        Host host = getHost();
+        if (this.hostConfigDir == null) {
+            this.hostConfigDir = TomcatConfigLocator.resolveHostConfigDir(this.configDir, host);
+        }
+        if (this.hostConfigDir != null) {
+            host.setXmlBase(this.hostConfigDir);
+            host.getConfigBaseFile();
+        }
 
         // Allocate the web application's configuration directory
-        Host host = getHost();
-        File configLocation = WebappConfigLocator.resolveWebappConfigDir(this.configDir, host);
+        Path configLocation = WebappConfigLocator.resolveWebappConfigDir(this.configDir, host);
 
         // If web application's context.xml is existing, set it to the StandardContext
         try {
             context.setConfigFile(WebappConfigLocator.resolveWebappContextXml(path, docBase, configLocation, bundle));
         } catch (MalformedURLException e) {
-            throw new ServletContainerException("Cannot resolve web application's context.xml " + docBase, e);
+            throw new ServletContainerException("Cannot resolve web application's context.xml [" + docBase + "].", e);
         }
 
         context.setDocBase(docBase);
         context.setPath(path.equals(ROOT_PATH) ? ROOT_CONTEXT_PATH : path);
+        context.setName(context.getPath());
 
         context.setJarScanner(getJarScanner(bundle));
 
@@ -295,9 +306,7 @@
         return context;
     }
 
-    public void configure(InputStream configuration) {
-        initBaseDir();
-
+    void configure(InputStream configuration) {
         Digester digester = this.catalina.createStartDigester();
         digester.push(this);
 
@@ -314,6 +323,8 @@
             throw new ServletContainerException("Error parsing Tomcat XML configuration.", e);
         }
 
+        initBaseDir();
+
         // Allocate the tomcat's configuration directory
         this.configDir = TomcatConfigLocator.resolveConfigDir(this.bundleContext);
 
@@ -322,50 +333,73 @@
 
         // Allocate the default web.xml
         this.defaultWeb = WebappConfigLocator.resolveDefaultWebXml(this.configDir);
+
+        Host host = getHost();
+        this.hostConfigDir = TomcatConfigLocator.resolveHostConfigDir(this.configDir, host);
+        if (this.hostConfigDir != null) {
+            host.setXmlBase(this.hostConfigDir);
+            host.getConfigBaseFile();
+        }
     }
 
     @Override
     protected void initBaseDir() {
+        String catalinaHome = System.getProperty(Globals.CATALINA_HOME_PROP);
         if (this.basedir == null) {
             this.basedir = System.getProperty(Globals.CATALINA_BASE_PROP);
         }
         if (this.basedir == null) {
-            this.basedir = System.getProperty(Globals.CATALINA_HOME_PROP);
+            this.basedir = catalinaHome;
         }
         if (this.basedir == null) {
             // Create a temp dir.
-            this.basedir = System.getProperty(USER_DIR);
-            Path home = Paths.get(this.basedir);
+            this.basedir = System.getProperty(USER_DIR) + "/tomcat." + this.port;
+        }
+        Path baseFile = Paths.get(this.basedir);
+        try {
+            Files.createDirectories(baseFile);
+        } catch (IOException e1) {
+            throw new IllegalStateException("Cannot create directories for [" + baseFile + "].", e1);
+        }
+        try {
+            this.basedir = baseFile.toRealPath().toString();
+        } catch (IOException e) {
+            this.basedir = baseFile.toAbsolutePath().toString();
+        }
+
+        this.server.setCatalinaBase(new File(this.basedir));
+        this.oldCatalinaBaseDir = System.setProperty(Globals.CATALINA_BASE_PROP, this.basedir);
+
+        if (catalinaHome == null) {
+            this.server.setCatalinaHome(new File(this.basedir));
+        } else {
+            Path homeFile = Paths.get(catalinaHome);
             try {
-                Files.createDirectories(home);
+                Files.createDirectories(homeFile);
             } catch (IOException e1) {
-                if (LOGGER.isDebugEnabled()) {
-                    LOGGER.debug("Cannot create directory " + home);
-                }
+                throw new IllegalStateException("Cannot create directories for [" + homeFile + "].", e1);
             }
-            if (!home.isAbsolute()) {
-                try {
-                    this.basedir = home.toRealPath().toString();
-                } catch (IOException e) {
-                    this.basedir = home.toAbsolutePath().toString();
-                }
+            try {
+                this.server.setCatalinaHome(homeFile.toRealPath().toFile());
+            } catch (IOException e) {
+                this.server.setCatalinaHome(homeFile.toAbsolutePath().toFile());
             }
         }
+
         this.oldCatalinaHomeDir = System.setProperty(Globals.CATALINA_HOME_PROP, this.basedir);
-        this.oldCatalinaBaseDir = System.setProperty(Globals.CATALINA_BASE_PROP, this.basedir);
     }
 
     /**
      * Maps the specified login method to the specified authenticator, allowing the mappings in
      * org/apache/catalina/startup/Authenticators.properties to be overridden.
-     * 
+     *
      * @param authenticator Authenticator to handle authentication for the specified login method
      * @param loginMethod Login method that maps to the specified authenticator
-     * 
+     *
      * @throws IllegalArgumentException if the specified authenticator does not implement the org.apache.catalina.Valve
      *         interface
      */
-    public void addAuthenticator(Authenticator authenticator, String loginMethod) {
+    void addAuthenticator(Authenticator authenticator, String loginMethod) {
         if (!(authenticator instanceof Valve)) {
             throw new IllegalArgumentException("Specified Authenticator is not a Valve");
         }
@@ -381,8 +415,8 @@
 
     /**
      * Overrides {@link Catalina} to provide public access to {@link Catalina#createStartDigester}.
-     * 
-     * 
+     *
+     *
      */
     private static class ExtendCatalina extends Catalina {
 
@@ -396,34 +430,10 @@
     /**
      * Override {@link ContextConfig}. This changes the {@link ClassLoader} used to load the web-embed.xml to the
      * <code>ClassLoader</code> of this bundle.
-     * 
-     * 
+     *
+     *
      */
     private static class ExtendedContextConfig extends ContextConfig {
-
-        private File configDir;
-
-        /**
-         * If there is not configuration directory, return custom configuration directory. It is used to resolve the
-         * context.xml.default
-         */
-        @Override
-        protected File getConfigBase() {
-            File configBase = super.getConfigBase();
-            if (configBase != null) {
-                return configBase;
-            }
-
-            if (this.configDir != null) {
-                return this.configDir;
-            }
-
-            return null;
-        }
-
-        protected void setConfigBase(File configDir) {
-            this.configDir = configDir;
-        }
     }
 
     /**
diff --git a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/TomcatConfigLocator.java b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/TomcatConfigLocator.java
index c942dd0..6cb6bc3 100644
--- a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/TomcatConfigLocator.java
+++ b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/TomcatConfigLocator.java
@@ -1,14 +1,14 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2010 VMware Inc.
+ * Copyright (c) 2009, 2015 VMware Inc.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution. 
+ * and Apache License v2.0 which accompanies this distribution.
  * The Eclipse Public License is available at
  *   http://www.eclipse.org/legal/epl-v10.html
- * and the Apache License v2.0 is available at 
+ * and the Apache License v2.0 is available at
  *   http://www.opensource.org/licenses/apache2.0.php.
- * You may elect to redistribute this code under either of these licenses.  
+ * You may elect to redistribute this code under either of these licenses.
  *
  * Contributors:
  *   VMware Inc. - initial contribution
@@ -17,13 +17,17 @@
 package org.eclipse.gemini.web.tomcat.internal;
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Enumeration;
 
+import org.apache.catalina.Container;
+import org.apache.catalina.Engine;
+import org.apache.catalina.Host;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
@@ -40,8 +44,8 @@
  * <li>Check this bundle for <code>/META-INF/tomcat/default-server.xml, use if found</code></li>
  * <li>Throw {@link IllegalStateException} if no configuration is found</li>
  * </ol>
- * 
- * 
+ *
+ *
  */
 final class TomcatConfigLocator {
 
@@ -57,7 +61,7 @@
 
     static final String USER_CONFIG_PATH = "server.xml";
 
-    public static InputStream resolveConfigFile(BundleContext context) throws BundleException {
+    static InputStream resolveConfigFile(BundleContext context) throws BundleException {
         Bundle bundle = context.getBundle();
 
         InputStream is = lookupConfigInFileSystem(context);
@@ -70,52 +74,73 @@
 
     /**
      * Returns the directory where the Tomcat configuration files resides.
-     * 
+     *
      * The location algorithm is as follows:
      * <ol>
      * <li>Check for <code>org.eclipse.gemini.web.tomcat.config.path</code> framework property, use if found</li>
      * <li>Check for <code>config/tomcat-server.xml</code> in the current working directory, use if found</li>
      * <li>If the previous checks do not return a result, return <code>null</code></li>
      * </ol>
-     * 
+     *
      * @param context the bundle context
      * @return the directory where the Tomcat configuration files resides.
      */
-    public static File resolveConfigDir(BundleContext context) {
-        File configFile = null;
+    static Path resolveConfigDir(BundleContext context) {
+        Path configFile = null;
 
         /*
          * Search for the framework property 'org.eclipse.gemini.web.tomcat.config.path'
-         * 
+         *
          * Note: this is supposed to search framework and system properties but appears to ignore system properties
          * which are set after the framework has initialised. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=319679.
          */
         String path = context.getProperty(TomcatConfigLocator.CONFIG_PATH_FRAMEWORK_PROPERTY);
         if (path != null) {
-            configFile = new File(path);
-            if (configFile.exists()) {
-                return configFile.getParentFile();
+            configFile = Paths.get(path);
+            if (Files.exists(configFile)) {
+                return configFile.getParent();
             }
         }
 
         // Search for the system property 'org.eclipse.gemini.web.tomcat.config.path'
         path = System.getProperty(TomcatConfigLocator.CONFIG_PATH_FRAMEWORK_PROPERTY);
         if (path != null) {
-            configFile = new File(path);
-            if (configFile.exists()) {
-                return configFile.getParentFile();
+            configFile = Paths.get(path);
+            if (Files.exists(configFile)) {
+                return configFile.getParent();
             }
         }
 
         // Search for the 'config' directory
-        configFile = new File(TomcatConfigLocator.DEFAULT_CONFIG_FILE_PATH);
-        if (configFile.exists()) {
-            return configFile.getParentFile();
+        configFile = Paths.get(TomcatConfigLocator.DEFAULT_CONFIG_FILE_PATH);
+        if (Files.exists(configFile)) {
+            return configFile.getParent();
         }
 
         return null;
     }
 
+    static String resolveHostConfigDir(Path configDir, Host host) {
+        if (configDir == null) {
+            return null;
+        }
+
+        StringBuilder xmlDir;
+        try {
+            xmlDir = new StringBuilder(configDir.toRealPath().toString());
+        } catch (IOException e) {
+            return null;
+        }
+        Container parent = host.getParent();
+        if (parent instanceof Engine) {
+            xmlDir.append('/');
+            xmlDir.append(parent.getName());
+        }
+        xmlDir.append('/');
+        xmlDir.append(host.getName());
+        return xmlDir.toString();
+    }
+
     private static InputStream lookupConfigInFileSystem(BundleContext context) {
         InputStream result = null;
 
@@ -131,17 +156,16 @@
     }
 
     private static InputStream tryGetStreamForFilePath(String filePath) {
-        File configFile = new File(filePath);
-        if (configFile.exists()) {
-
+        Path configFile = Paths.get(filePath);
+        if (Files.exists(configFile)) {
             try {
-                FileInputStream fis = new FileInputStream(configFile);
+                InputStream fis = Files.newInputStream(configFile);
                 if (LOGGER.isInfoEnabled()) {
-                    LOGGER.info("Configuring Tomcat from file '" + configFile + "'");
+                    LOGGER.info("Configuring Tomcat from file [" + configFile + "].");
                 }
                 return fis;
-            } catch (FileNotFoundException e) {
-                LOGGER.warn("Found config file on disk but then received FileNotFoundException when trying to access", e);
+            } catch (IOException e) {
+                LOGGER.warn("Found config file on disk but then received IOException when trying to access.", e);
             }
         }
         return null;
@@ -149,25 +173,26 @@
 
     private static InputStream lookupConfigInBundle(Bundle bundle) throws BundleException {
         URL entry = null;
-        Enumeration<?> entries = bundle.findEntries(CONFIG_PATH, USER_CONFIG_PATH, false);
+        Enumeration<URL> entries = bundle.findEntries(CONFIG_PATH, USER_CONFIG_PATH, false);
         if (entries != null && entries.hasMoreElements()) {
-            entry = (URL) entries.nextElement();
+            entry = entries.nextElement();
             if (LOGGER.isInfoEnabled()) {
-                LOGGER.info("Configuring Tomcat from fragment entry '" + entry + "'");
+                LOGGER.info("Configuring Tomcat from fragment entry [" + entry + "].");
             }
         } else {
             entry = bundle.getEntry(DEFAULT_CONFIG_PATH);
             if (entry == null) {
-                throw new IllegalStateException("Unable to locate default Tomcat configuration. Is the '" + bundle + "' bundle corrupt?");
-            } else if (LOGGER.isInfoEnabled()) {
-                LOGGER.info("Configuring Tomcat from default config file");
+                throw new IllegalStateException("Unable to locate default Tomcat configuration. Is the [" + bundle + "] bundle corrupt?");
+            }
+            if (LOGGER.isInfoEnabled()) {
+                LOGGER.info("Configuring Tomcat from default config file.");
             }
         }
 
         try {
             return entry.openStream();
         } catch (IOException e) {
-            throw new BundleException("Unable to open Tomcat configuration at '" + entry + "'");
+            throw new BundleException("Unable to open Tomcat configuration at [" + entry + "].");
         }
     }
 }
diff --git a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/WebappConfigLocator.java b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/WebappConfigLocator.java
index 80a3856..cc8f91b 100755
--- a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/WebappConfigLocator.java
+++ b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/WebappConfigLocator.java
@@ -1,14 +1,14 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2014 SAP AG
+ * Copyright (c) 2010, 2015 SAP SE
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution. 
+ * and Apache License v2.0 which accompanies this distribution.
  * The Eclipse Public License is available at
  *   http://www.eclipse.org/legal/epl-v10.html
- * and the Apache License v2.0 is available at 
+ * and the Apache License v2.0 is available at
  *   http://www.opensource.org/licenses/apache2.0.php.
- * You may elect to redistribute this code under either of these licenses.  
+ * You may elect to redistribute this code under either of these licenses.
  *
  * Contributors:
  *   Violeta Georgieva - initial contribution
@@ -16,12 +16,14 @@
 
 package org.eclipse.gemini.web.tomcat.internal;
 
-import java.io.File;
 import java.io.IOException;
 import java.net.JarURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;
 
@@ -31,7 +33,7 @@
 import org.eclipse.gemini.web.core.spi.ServletContainerException;
 import org.osgi.framework.Bundle;
 
-public class WebappConfigLocator {
+final class WebappConfigLocator {
 
     static final String DEFAULT_CONFIG_DIRECTORY = "config";
 
@@ -61,19 +63,19 @@
      * Resolves the default context.xml and returns a relative path to it, if it exists in the main Tomcat's
      * configuration directory, otherwise returns <code>null</code>. The method returns <code>null</code> also in case
      * main Tomcat's configuration directory does not exists.
-     * 
+     *
      * @param configLocation the main Tomcat's configuration directory
      * @return a relative path to default context.xml file, if it exists in the main Tomcat's configuration directory,
      *         otherwise returns <code>null</code>.
      */
-    public static String resolveDefaultContextXml(File configLocation) {
+    static String resolveDefaultContextXml(Path configLocation) {
         if (configLocation == null) {
             return null;
         }
 
-        File defaultContextXml = new File(configLocation, DEFAULT_CONTEXT_XML);
-        if (defaultContextXml.exists()) {
-            return defaultContextXml.getAbsolutePath();
+        Path defaultContextXml = configLocation.resolve(DEFAULT_CONTEXT_XML);
+        if (Files.exists(defaultContextXml)) {
+            return defaultContextXml.toAbsolutePath().toString();
         }
         return null;
     }
@@ -83,19 +85,19 @@
      * directory, otherwise returns <code>null</code>. The method returns <code>null</code> also in case main Tomcat's
      * configuration directory does not exists. Note: If a default web.xml is not found then web-embed.xml will be used
      * as default web.xml. (web-embed.xml is provided by this bundle)
-     * 
+     *
      * @param configLocation the main Tomcat's configuration directory
      * @return an absolute path to default web.xml file, if it exists in the main Tomcat's configuration directory,
      *         otherwise returns <code>null</code>.
      */
-    public static String resolveDefaultWebXml(File configLocation) {
+    static String resolveDefaultWebXml(Path configLocation) {
         if (configLocation == null) {
             return null;
         }
 
-        File defaultWebXml = new File(configLocation, DEFAULT_WEB_XML);
-        if (defaultWebXml.exists()) {
-            return defaultWebXml.getAbsolutePath();
+        Path defaultWebXml = configLocation.resolve(DEFAULT_WEB_XML);
+        if (Files.exists(defaultWebXml)) {
+            return defaultWebXml.toAbsolutePath().toString();
         }
 
         return null;
@@ -113,7 +115,7 @@
      * the one in the archive.</li>
      * <li>Return <code>null</code> in other cases.</li>
      * </ol>
-     * 
+     *
      * @param path the context path
      * @param docBase the root directory/file for the web application
      * @param configLocation Host's configuration directory
@@ -121,13 +123,13 @@
      * @return the context.xml if it is found following the algorithm above, otherwise <code>null</code>
      * @throws MalformedURLException
      */
-    public static URL resolveWebappContextXml(String path, String docBase, File configLocation, Bundle bundle) throws MalformedURLException {
+    static URL resolveWebappContextXml(String path, String docBase, Path configLocation, Bundle bundle) throws MalformedURLException {
         path = formatContextPath(path);
 
         // Try to find the context.xml in the Tomcat's configuration directory
-        File contextXml = new File(configLocation, path + XML_EXTENSION);
-        if (contextXml.exists()) {
-            return contextXml.toURI().toURL();
+        Path contextXml = configLocation.resolve(path + XML_EXTENSION);
+        if (Files.exists(contextXml)) {
+            return contextXml.toUri().toURL();
         }
 
         // Try to find the context.xml in docBase
@@ -138,20 +140,20 @@
             return null;
         }
 
-        File docBaseFile = new File(docBase);
-        if (docBaseFile.isDirectory()) {
-            contextXml = new File(docBaseFile, CONTEXT_XML);
-            if (contextXml.exists()) {
-                return contextXml.toURI().toURL();
+        Path docBaseFile = Paths.get(docBase);
+        if (Files.isDirectory(docBaseFile)) {
+            contextXml = docBaseFile.resolve(CONTEXT_XML);
+            if (Files.exists(contextXml)) {
+                return contextXml.toUri().toURL();
             }
         } else {
-            try (JarFile jar = new JarFile(docBaseFile);) {
+            try (JarFile jar = new JarFile(docBaseFile.toFile());) {
                 ZipEntry contextXmlEntry = jar.getEntry(CONTEXT_XML);
                 if (contextXmlEntry != null) {
-                    return new URL(JAR_SCHEMA + docBaseFile.toURI().toString() + JAR_TO_ENTRY_SEPARATOR + CONTEXT_XML);
+                    return new URL(JAR_SCHEMA + docBaseFile.toUri().toString() + JAR_TO_ENTRY_SEPARATOR + CONTEXT_XML);
                 }
             } catch (IOException e) {
-                throw new ServletContainerException("Cannot open for reading " + docBaseFile.getAbsolutePath(), e);
+                throw new ServletContainerException("Cannot open for reading [" + docBaseFile.toAbsolutePath().toString() + "].", e);
             }
         }
         return null;
@@ -160,22 +162,22 @@
     /**
      * Resolves the directory where the web application' context.xml files are placed. Typically this is the Host's
      * configuration directory.
-     * 
+     *
      * @param mainConfigDir the main Tomcat's configuration directory
      * @param host host
      * @return the directory where the web applications' context.xml files are placed.
      */
-    public static File resolveWebappConfigDir(File mainConfigDir, Host host) {
-        mainConfigDir = mainConfigDir != null ? mainConfigDir : new File(DEFAULT_CONFIG_DIRECTORY);
+    static Path resolveWebappConfigDir(Path mainConfigDir, Host host) {
+        mainConfigDir = mainConfigDir != null ? mainConfigDir : Paths.get(DEFAULT_CONFIG_DIRECTORY);
 
-        File configLocation = mainConfigDir;
+        Path configLocation = mainConfigDir;
 
         Container parent = host.getParent();
         if (parent != null && parent instanceof Engine) {
-            configLocation = new File(configLocation, parent.getName());
+            configLocation = configLocation.resolve(parent.getName());
         }
 
-        return new File(configLocation, host.getName());
+        return configLocation.resolve(host.getName());
     }
 
     private static String formatContextPath(String contextPath) {
diff --git a/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/TomcatConfigLocatorTests.java b/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/TomcatConfigLocatorTests.java
index 7bf9e4f..7e184a0 100644
--- a/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/TomcatConfigLocatorTests.java
+++ b/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/TomcatConfigLocatorTests.java
@@ -80,7 +80,7 @@
 
         String result = "src" + File.separator + "test" + File.separator + "resources";
 
-        assertTrue(TomcatConfigLocator.resolveConfigDir(mockContext).getAbsolutePath().endsWith(result));
+        assertTrue(TomcatConfigLocator.resolveConfigDir(mockContext).toAbsolutePath().endsWith(result));
         assertEquals(null, TomcatConfigLocator.resolveConfigDir(mockContext));
         assertEquals(null, TomcatConfigLocator.resolveConfigDir(mockContext));
 
diff --git a/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/TomcatServletContainerFactoryTests.java b/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/TomcatServletContainerFactoryTests.java
index 4968201..78bb80c 100644
--- a/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/TomcatServletContainerFactoryTests.java
+++ b/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/TomcatServletContainerFactoryTests.java
@@ -1,14 +1,14 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2012 VMware Inc.
+ * Copyright (c) 2009, 2015 VMware Inc.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution. 
+ * and Apache License v2.0 which accompanies this distribution.
  * The Eclipse Public License is available at
  *   http://www.eclipse.org/legal/epl-v10.html
- * and the Apache License v2.0 is available at 
+ * and the Apache License v2.0 is available at
  *   http://www.opensource.org/licenses/apache2.0.php.
- * You may elect to redistribute this code under either of these licenses.  
+ * You may elect to redistribute this code under either of these licenses.
  *
  * Contributors:
  *   VMware Inc. - initial contribution
@@ -22,7 +22,8 @@
 import static org.easymock.EasyMock.verify;
 import static org.junit.Assert.assertNotNull;
 
-import java.io.FileInputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 
 import org.eclipse.gemini.web.core.spi.ServletContainerException;
 import org.junit.Before;
@@ -38,7 +39,7 @@
         this.bundleContext = createMock(BundleContext.class);
         expect(this.bundleContext.getProperty(TomcatConfigLocator.CONFIG_PATH_FRAMEWORK_PROPERTY)).andReturn(null);
         expect(this.bundleContext.getProperty(OsgiAwareEmbeddedTomcat.USE_NAMING)).andReturn(null);
-        expect(this.bundleContext.getProperty(BundleDependenciesJarScanner.SCANNER_SKIP_BUNDLES_PROPERTY_NAME)).andReturn(null);
+        expect(this.bundleContext.getProperty(BundleDependenciesJarScanFilter.SCANNER_SKIP_BUNDLES_PROPERTY_NAME)).andReturn(null);
         expect(this.bundleContext.createFilter("(objectClass=org.eclipse.gemini.web.tomcat.spi.ClassLoaderCustomizer)")).andReturn(null);
         expect(this.bundleContext.createFilter("(objectClass=org.eclipse.gemini.web.tomcat.spi.JarScannerCustomizer)")).andReturn(null);
         expect(this.bundleContext.getBundle()).andReturn(null);
@@ -48,7 +49,7 @@
     public void testCreateContainerWithConfigFile() throws Exception {
         TomcatServletContainerFactory factory = new TomcatServletContainerFactory();
         replay(this.bundleContext);
-        TomcatServletContainer container = factory.createContainer(new FileInputStream("src/test/resources/server.xml"), this.bundleContext);
+        TomcatServletContainer container = factory.createContainer(Files.newInputStream(Paths.get("src/test/resources/server.xml")), this.bundleContext);
         assertNotNull(container);
         verify(this.bundleContext);
     }
@@ -57,7 +58,7 @@
     public void testCreateContainerWithInvalidConfigFile() throws Exception {
         TomcatServletContainerFactory factory = new TomcatServletContainerFactory();
         replay(this.bundleContext);
-        TomcatServletContainer container = factory.createContainer(new FileInputStream("src/test/resources/invalid-server.xml"), this.bundleContext);
+        TomcatServletContainer container = factory.createContainer(Files.newInputStream(Paths.get("src/test/resources/invalid-server.xml")), this.bundleContext);
         assertNotNull(container);
         verify(this.bundleContext);
     }
diff --git a/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/TomcatServletContainerTests.java b/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/TomcatServletContainerTests.java
index 593ecea..07e9b5e 100644
--- a/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/TomcatServletContainerTests.java
+++ b/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/TomcatServletContainerTests.java
@@ -1,14 +1,14 @@
 /*******************************************************************************
- * Copyright (c) 2012, 2014 SAP AG
+ * Copyright (c) 2012, 2015 SAP SE
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution. 
+ * and Apache License v2.0 which accompanies this distribution.
  * The Eclipse Public License is available at
  *   http://www.eclipse.org/legal/epl-v10.html
- * and the Apache License v2.0 is available at 
+ * and the Apache License v2.0 is available at
  *   http://www.opensource.org/licenses/apache2.0.php.
- * You may elect to redistribute this code under either of these licenses.  
+ * You may elect to redistribute this code under either of these licenses.
  *
  * Contributors:
  *   Violeta Georgieva - initial contribution
@@ -36,7 +36,7 @@
 import org.eclipse.gemini.web.core.spi.ContextPathExistsException;
 import org.eclipse.gemini.web.core.spi.ServletContainerException;
 import org.eclipse.gemini.web.core.spi.WebApplicationHandle;
-import org.eclipse.gemini.web.tomcat.internal.loading.BundleWebappLoader;
+import org.eclipse.gemini.web.tomcat.internal.loader.BundleWebappLoader;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -87,7 +87,7 @@
         expect(this.bundleContext.createFilter(FILTER_1)).andReturn(this.filter);
         expect(this.bundleContext.createFilter(FILTER_2)).andReturn(this.filter);
         expect(this.bundleContext.getProperty(OsgiAwareEmbeddedTomcat.USE_NAMING)).andReturn(OsgiAwareEmbeddedTomcat.NAMING_DISABLED);
-        expect(this.bundleContext.getProperty(BundleDependenciesJarScanner.SCANNER_SKIP_BUNDLES_PROPERTY_NAME)).andReturn(null);
+        expect(this.bundleContext.getProperty(BundleDependenciesJarScanFilter.SCANNER_SKIP_BUNDLES_PROPERTY_NAME)).andReturn(null);
 
         expect(this.server.findServices()).andReturn(new Service[] { this.service }).anyTimes();
         this.server.init();
@@ -216,7 +216,7 @@
         }
 
         @Override
-        public void setState(LifecycleState lifecycleState) {
+        public synchronized void setState(LifecycleState lifecycleState) {
             this.lifecycleState = lifecycleState;
         }
     }
diff --git a/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/WebappConfigLocatorTests.java b/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/WebappConfigLocatorTests.java
index 37314bc..b081254 100755
--- a/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/WebappConfigLocatorTests.java
+++ b/org.eclipse.gemini.web.tomcat/src/test/java/org/eclipse/gemini/web/tomcat/internal/WebappConfigLocatorTests.java
@@ -1,14 +1,14 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2014 SAP AG
+ * Copyright (c) 2010, 2015 SAP SE
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution. 
+ * and Apache License v2.0 which accompanies this distribution.
  * The Eclipse Public License is available at
  *   http://www.eclipse.org/legal/epl-v10.html
- * and the Apache License v2.0 is available at 
+ * and the Apache License v2.0 is available at
  *   http://www.opensource.org/licenses/apache2.0.php.
- * You may elect to redistribute this code under either of these licenses.  
+ * You may elect to redistribute this code under either of these licenses.
  *
  * Contributors:
  *   Violeta Georgieva - initial contribution
@@ -23,11 +23,13 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.jar.JarEntry;
 import java.util.jar.JarOutputStream;
 import java.util.jar.Manifest;
@@ -87,9 +89,9 @@
         byte[] buffer = new byte[1024];
         int bytesRead;
 
-        try (FileOutputStream stream = new FileOutputStream(jarFile1.getPath());
+        try (OutputStream stream = Files.newOutputStream(Paths.get(jarFile1.getPath()));
             JarOutputStream out = new JarOutputStream(stream, new Manifest());
-            FileInputStream file = new FileInputStream(new File(urlFile2.getPath()));) {
+            InputStream file = Files.newInputStream(Paths.get(urlFile2.getPath()));) {
             JarEntry jarAdd = new JarEntry(JAR_ENTRY_NAME);
             out.putNextEntry(jarAdd);
             while ((bytesRead = file.read(buffer)) != -1) {
@@ -98,7 +100,8 @@
             out.closeEntry();
         }
 
-        try (FileOutputStream stream = new FileOutputStream(jarFile2.getPath()); JarOutputStream out = new JarOutputStream(stream, new Manifest());) {
+        try (OutputStream stream = Files.newOutputStream(Paths.get(jarFile2.getPath()));
+            JarOutputStream out = new JarOutputStream(stream, new Manifest());) {
         }
     }
 
@@ -107,26 +110,26 @@
         URL urlFile1 = new URL(CONFIG_FILE_LOCATION_1);
         URL urlDir1 = new URL(CONFIG_DIR_LOCATION_1);
         // context.xml exists in the configuration directory
-        assertEquals(new File(urlFile1.getPath()).getAbsoluteFile().toURI().toURL(),
-            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_1, null, new File(urlDir1.getPath()), null));
+        assertEquals(Paths.get(urlFile1.getPath()).toAbsolutePath().toUri().toURL(),
+            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_1, null, Paths.get(urlDir1.getPath()), null));
 
         URL urlFile2 = new URL(CONFIG_FILE_LOCATION_2);
         URL urlDir2 = new URL(CONFIG_DIR_LOCATION_2);
         // context.xml does not exist in the configuration directory, but exists
         // in doc base
         // doc base is directory
-        assertEquals(new File(urlFile2.getPath()).getAbsoluteFile().toURI().toURL(),
-            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_2, urlDir1.getPath(), new File(urlDir1.getPath()), null));
+        assertEquals(Paths.get(urlFile2.getPath()).toAbsolutePath().toUri().toURL(),
+            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_2, urlDir1.getPath(), Paths.get(urlDir1.getPath()), null));
         // context.xml does not exist in the configuration directory and in doc
         // base
         // doc base is directory
-        assertEquals(null, WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_2, urlDir2.getPath(), new File(urlDir1.getPath()), null));
+        assertEquals(null, WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_2, urlDir2.getPath(), Paths.get(urlDir1.getPath()), null));
 
         try {
             // context.xml does not exist in the configuration directory, doc
             // base is jar and does not exist
             URL corruptedJarFile = new URL(CORRUPTED_JAR_NAME);
-            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_2, corruptedJarFile.getPath(), new File(urlDir1.getPath()), null);
+            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_2, corruptedJarFile.getPath(), Paths.get(urlDir1.getPath()), null);
         } catch (ServletContainerException e) {
             assertTrue(e.getCause() instanceof IOException);
         }
@@ -138,38 +141,38 @@
         // in doc base
         // doc base is jar
         // context.xml will be read from the jar
-        assertEquals(new URL(WebappConfigLocator.JAR_SCHEMA + new File(jarFile1.getPath()).getAbsoluteFile().toURI().toString()
+        assertEquals(new URL(WebappConfigLocator.JAR_SCHEMA + Paths.get(jarFile1.getPath()).toAbsolutePath().toUri().toString()
             + WebappConfigLocator.JAR_TO_ENTRY_SEPARATOR + WebappConfigLocator.CONTEXT_XML),
-            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_2, jarFile1.getPath(), new File(urlDir3.getPath()), null));
+            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_2, jarFile1.getPath(), Paths.get(urlDir3.getPath()), null));
 
         // context.xml does not exist in the configuration directory, but exists in doc base
         // doc base cannot be resolved
         // bundle is not provided
         assertEquals(null,
-            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_2, WebappConfigLocator.EMPTY_STRING, new File(urlDir3.getPath()), null));
+            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_2, WebappConfigLocator.EMPTY_STRING, Paths.get(urlDir3.getPath()), null));
         // context.xml will be read from the bundle
         Bundle bundle = createMock(Bundle.class);
-        expect(bundle.getLocation()).andReturn(new File(jarFile1.getPath()).getAbsoluteFile().toURI().toString());
+        expect(bundle.getLocation()).andReturn(Paths.get(jarFile1.getPath()).toAbsolutePath().toUri().toString());
         replay(bundle);
-        assertEquals(new URL(WebappConfigLocator.JAR_SCHEMA + new File(jarFile1.getPath()).getAbsoluteFile().toURI().toString()
+        assertEquals(new URL(WebappConfigLocator.JAR_SCHEMA + Paths.get(jarFile1.getPath()).toAbsolutePath().toUri().toString()
             + WebappConfigLocator.JAR_TO_ENTRY_SEPARATOR + WebappConfigLocator.CONTEXT_XML),
-            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_2, WebappConfigLocator.EMPTY_STRING, new File(urlDir3.getPath()), bundle));
+            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_2, WebappConfigLocator.EMPTY_STRING, Paths.get(urlDir3.getPath()), bundle));
         verify(bundle);
 
         // context.xml does not exist in the configuration directory and in doc
         // base
         // doc base is jar
-        assertEquals(null, WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_2, jarFile2.getPath(), new File(urlDir1.getPath()), null));
+        assertEquals(null, WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_2, jarFile2.getPath(), Paths.get(urlDir1.getPath()), null));
 
         URL urlFile4 = new URL(CONFIG_FILE_LOCATION_4);
         URL urlFile5 = new URL(CONFIG_FILE_LOCATION_5);
         // different types of context path
-        assertEquals(new File(urlFile4.getPath()).getAbsoluteFile().toURI().toURL(),
-            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_3, jarFile1.getPath(), new File(urlDir3.getPath()), null));
-        assertEquals(new File(urlFile5.toURI().getSchemeSpecificPart()).getAbsoluteFile().toURI().toURL(),
-            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_4, jarFile1.getPath(), new File(urlDir3.getPath()), null));
-        assertEquals(new File(urlFile5.toURI().getSchemeSpecificPart()).getAbsoluteFile().toURI().toURL(),
-            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_5, jarFile1.getPath(), new File(urlDir3.getPath()), null));
+        assertEquals(Paths.get(urlFile4.getPath()).toAbsolutePath().toUri().toURL(),
+            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_3, jarFile1.getPath(), Paths.get(urlDir3.getPath()), null));
+        assertEquals(Paths.get(urlFile5.toURI().getSchemeSpecificPart()).toAbsolutePath().toUri().toURL(),
+            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_4, jarFile1.getPath(), Paths.get(urlDir3.getPath()), null));
+        assertEquals(Paths.get(urlFile5.toURI().getSchemeSpecificPart()).toAbsolutePath().toUri().toURL(),
+            WebappConfigLocator.resolveWebappContextXml(CONTEXT_PATH_5, jarFile1.getPath(), Paths.get(urlDir3.getPath()), null));
     }
 
     @Test
@@ -184,21 +187,21 @@
 
         replay(mockHost, mockEngine);
 
-        File configDir = new File("");
-        File expected = new File(configDir, ENGINE_NAME);
-        expected = new File(expected, HOST_NAME);
+        Path configDir = Paths.get("");
+        Path expected = configDir.resolve(ENGINE_NAME);
+        expected = expected.resolve(HOST_NAME);
         assertEquals(expected, WebappConfigLocator.resolveWebappConfigDir(configDir, mockHost));
 
-        expected = new File(configDir, HOST_NAME);
+        expected = configDir.resolve(HOST_NAME);
         assertEquals(expected, WebappConfigLocator.resolveWebappConfigDir(configDir, mockHost));
         assertEquals(expected, WebappConfigLocator.resolveWebappConfigDir(configDir, mockHost));
 
-        configDir = new File(WebappConfigLocator.DEFAULT_CONFIG_DIRECTORY);
-        expected = new File(configDir, ENGINE_NAME);
-        expected = new File(expected, HOST_NAME);
+        configDir = Paths.get(WebappConfigLocator.DEFAULT_CONFIG_DIRECTORY);
+        expected = configDir.resolve(ENGINE_NAME);
+        expected = expected.resolve(HOST_NAME);
         assertEquals(expected, WebappConfigLocator.resolveWebappConfigDir(null, mockHost));
 
-        expected = new File(configDir, HOST_NAME);
+        expected = configDir.resolve(HOST_NAME);
         assertEquals(expected, WebappConfigLocator.resolveWebappConfigDir(null, mockHost));
         assertEquals(expected, WebappConfigLocator.resolveWebappConfigDir(null, mockHost));
 
@@ -210,18 +213,18 @@
         assertEquals(null, WebappConfigLocator.resolveDefaultContextXml(null));
 
         URL urlFile = new URL(CONFIG_FILE_LOCATION_2);
-        assertEquals(new File(urlFile.getPath()).getAbsolutePath(),
-            WebappConfigLocator.resolveDefaultContextXml(new File(urlFile.getPath()).getParentFile()));
+        assertEquals(Paths.get(urlFile.getPath()).toAbsolutePath().toString(),
+            WebappConfigLocator.resolveDefaultContextXml(Paths.get(urlFile.getPath()).getParent()));
 
-        assertEquals(null, WebappConfigLocator.resolveDefaultContextXml(new File(urlFile.getPath()).getParentFile().getParentFile()));
+        assertEquals(null, WebappConfigLocator.resolveDefaultContextXml(Paths.get(urlFile.getPath()).getParent().getParent()));
     }
 
     public void testResolveDefaultWebXml() throws Exception {
         assertEquals(null, WebappConfigLocator.resolveDefaultWebXml(null));
 
         URL configDir = new URL(CONFIG_DIR_LOCATION_1);
-        assertEquals(configDir.getPath(), WebappConfigLocator.resolveDefaultContextXml(new File(configDir.getPath()).getParentFile()));
+        assertEquals(configDir.getPath(), WebappConfigLocator.resolveDefaultContextXml(Paths.get(configDir.getPath()).getParent()));
 
-        assertEquals(null, WebappConfigLocator.resolveDefaultContextXml(new File(configDir.getPath()).getParentFile().getParentFile()));
+        assertEquals(null, WebappConfigLocator.resolveDefaultContextXml(Paths.get(configDir.getPath()).getParent().getParent()));
     }
 }
diff --git a/org.eclipse.gemini.web.tomcat/src/test/resources/server.xml b/org.eclipse.gemini.web.tomcat/src/test/resources/server.xml
index 9c7bf0d..db959c1 100644
--- a/org.eclipse.gemini.web.tomcat/src/test/resources/server.xml
+++ b/org.eclipse.gemini.web.tomcat/src/test/resources/server.xml
@@ -21,8 +21,8 @@
  -->
 <Server>
 
+  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
   <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
-  <Listener className="org.apache.catalina.core.JasperListener" />
   <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
   <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
 
@@ -35,8 +35,8 @@
     <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
 
     <Engine name="Catalina" defaultHost="localhost">
-      <Host name="localhost" deployOnStartup="false" unpackWARs="true"
-            autoDeploy="false" appBase="">
+      <Host name="localhost" deployOnStartup="false" autoDeploy="false"
+            unpackWARs="false" createDirs="false" appBase="">
       </Host>
     </Engine>
   </Service>