summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.java b/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.java
index 7d086cd0f3..35d8c91750 100644
--- a/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.java
+++ b/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.java
@@ -140,13 +140,20 @@ public class WebAppHelper {
servletContext.setAttribute(name, value);
}
host = getServletHost(servletContext);
- Node node = createAndStartNode(servletContext);
- servletContext.setAttribute(SCA_NODE_ATTRIBUTE, node);
- return host;
} catch (ServletException e) {
throw new RuntimeException(e);
}
}
+ Node node = (Node)servletContext.getAttribute(SCA_NODE_ATTRIBUTE);
+ if (node == null) {
+ try {
+ node = createAndStartNode(servletContext);
+ } catch (ServletException e) {
+ throw new RuntimeException(e);
+ }
+ servletContext.setAttribute(SCA_NODE_ATTRIBUTE, node);
+ }
+
return host;
}