private static WebAppContext buildContext() throws IOException {
ProtectionDomain protectionDomain = Startup.class.getProtectionDomain();
URL location = protectionDomain.getCodeSource().getLocation();
WebAppContext context = new WebAppContext();
WebAppClassLoader webAppClassLoader = new WebAppClassLoader(Startup.class.getClassLoader(),context);
context.setClassLoader(webAppClassLoader);
context.setContextPath(URIUtil.SLASH);
context.setWar(location.toExternalForm());
if( tempDir != null ) {