Index: C:/lokahi_branches/trunk/src/java/org/apache/lokahi/tomcat/api/entity/TomcatContextModel.java =================================================================== --- C:/lokahi_branches/trunk/src/java/org/apache/lokahi/tomcat/api/entity/TomcatContextModel.java (revision 534932) +++ C:/lokahi_branches/trunk/src/java/org/apache/lokahi/tomcat/api/entity/TomcatContextModel.java (working copy) @@ -447,10 +447,27 @@ this.jpInit(f, u, p, tc.getContextName()); if (!u.isAllowed(f)) throw new AuthorizationException("User " + u.getName() + " Not allowed to " + f.getName()); if (tc.getPk() < 1) throw new TMCIllegalArgumentException("Error with input"); + + TomcatContext origContext = TomcatContext.getTomcatContext(tc.getPk()); + + // before we update, check to see if the NEW pool is different than the OLD pool + if (origContext.getTomcatPoolId() != tc.getTomcatPoolId()) { + // if they are different, undeploy the old context before updating + this.undeployContext(this.jp, p, u, origContext); + } + TomcatContext.update(tc); this.installContext(jp, null, u, tc); TomcatPoolModel tpm = new TomcatPoolModel(); - tpm.deployTomcatConfig(u, null, jp, tc.getTomcatPool(), f); + + // check to see if the NEW pool is different than the OLD pool + if (origContext.getTomcatPoolId() != tc.getTomcatPoolId()) { + // if they are different deploy config files to OLD jvm + tpm.deployTomcatConfig(u, null, this.jp, origContext.getTomcatPool(), f); + } + + // deploy config files to NEW jvm + tpm.deployTomcatConfig(u, null, this.jp, tc.getTomcatPool(), f); jp.setState(State.NEW); JobPool.update(jp); }