diff --git a/archetype.product/src/main/resources/archetype-resources/pom.xml b/archetype.product/src/main/resources/archetype-resources/pom.xml index fd10ffb5c7..79b604f060 100644 --- a/archetype.product/src/main/resources/archetype-resources/pom.xml +++ b/archetype.product/src/main/resources/archetype-resources/pom.xml @@ -106,7 +106,7 @@ com.pmease commons.jsw - 3.5.14 + 1.0.1 provided diff --git a/commons.bootstrap/src/main/java/com/pmease/commons/bootstrap/Bootstrap.java b/commons.bootstrap/src/main/java/com/pmease/commons/bootstrap/Bootstrap.java index c596f14cb0..697ca3d631 100644 --- a/commons.bootstrap/src/main/java/com/pmease/commons/bootstrap/Bootstrap.java +++ b/commons.bootstrap/src/main/java/com/pmease/commons/bootstrap/Bootstrap.java @@ -138,29 +138,35 @@ public class Bootstrap { } ClassLoader appClassLoader = new URLClassLoader(urls.toArray(new URL[0]), Bootstrap.class.getClassLoader()); + ClassLoader originClassLoader = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(appClassLoader); - String appLoaderClassName = System.getProperty(APP_LOADER_PROPERTY_NAME); - if (appLoaderClassName == null) - appLoaderClassName = DEFAULT_APP_LOADER; - - final Lifecycle appLoader; try { - Class appLoaderClass = appClassLoader.loadClass(appLoaderClassName); - appLoader = (Lifecycle) appLoaderClass.newInstance(); - appLoader.start(); - } catch (Exception e) { - throw BootstrapUtils.unchecked(e); - } - - Runtime.getRuntime().addShutdownHook(new Thread() { - public void run() { - try { - appLoader.stop(); - } catch (Exception e) { - throw BootstrapUtils.unchecked(e); - } + String appLoaderClassName = System.getProperty(APP_LOADER_PROPERTY_NAME); + if (appLoaderClassName == null) + appLoaderClassName = DEFAULT_APP_LOADER; + + final Lifecycle appLoader; + try { + Class appLoaderClass = appClassLoader.loadClass(appLoaderClassName); + appLoader = (Lifecycle) appLoaderClass.newInstance(); + appLoader.start(); + } catch (Exception e) { + throw BootstrapUtils.unchecked(e); } - }); + + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + try { + appLoader.stop(); + } catch (Exception e) { + throw BootstrapUtils.unchecked(e); + } + } + }); + } finally { + Thread.currentThread().setContextClassLoader(originClassLoader); + } } private static void configureLogback() { diff --git a/commons.jsw/pom.xml b/commons.jsw/pom.xml index 535a2c54aa..cb50130e92 100644 --- a/commons.jsw/pom.xml +++ b/commons.jsw/pom.xml @@ -7,7 +7,7 @@ 1.0.0 commons.jsw - 3.5.14 + 1.0.1 @@ -54,5 +54,4 @@ http://artifact.pmease.com/ - \ No newline at end of file