tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r594672 - /openejb/trunk/openejb3/assembly/openejb-tomcat/src/main/java/org/apache/openejb/tomcat/TomcatWebAppBuilder.java
Date Tue, 13 Nov 2007 22:18:55 GMT
Author: dain
Date: Tue Nov 13 14:18:54 2007
New Revision: 594672

URL: http://svn.apache.org/viewvc?rev=594672&view=rev
Log:
Fixed redeployment of applications that failed in a previous deployment

Modified:
    openejb/trunk/openejb3/assembly/openejb-tomcat/src/main/java/org/apache/openejb/tomcat/TomcatWebAppBuilder.java

Modified: openejb/trunk/openejb3/assembly/openejb-tomcat/src/main/java/org/apache/openejb/tomcat/TomcatWebAppBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/assembly/openejb-tomcat/src/main/java/org/apache/openejb/tomcat/TomcatWebAppBuilder.java?rev=594672&r1=594671&r2=594672&view=diff
==============================================================================
--- openejb/trunk/openejb3/assembly/openejb-tomcat/src/main/java/org/apache/openejb/tomcat/TomcatWebAppBuilder.java
(original)
+++ openejb/trunk/openejb3/assembly/openejb-tomcat/src/main/java/org/apache/openejb/tomcat/TomcatWebAppBuilder.java
Tue Nov 13 14:18:54 2007
@@ -242,10 +242,13 @@
         contextInfo.standardContext = standardContext;
 
         WebAppInfo webAppInfo = null;
-        for (WebAppInfo w : contextInfo.appInfo.webApps) {
-            if (("/" + w.contextRoot).equals(standardContext.getPath())) {
-                webAppInfo = w;
-                break;
+        // appInfo is null when deployment fails
+        if (contextInfo.appInfo != null) {
+            for (WebAppInfo w : contextInfo.appInfo.webApps) {
+                if (("/" + w.contextRoot).equals(standardContext.getPath())) {
+                    webAppInfo = w;
+                    break;
+                }
             }
         }
 
@@ -274,6 +277,10 @@
     public void afterStart(StandardContext standardContext) {
         if (standardContext.getServletContext().getAttribute(IGNORE_CONTEXT) != null) return;
 
+        // if appInfo is null this is a failed deployment... just ignore
+        ContextInfo contextInfo = getContextInfo(standardContext);
+        if (contextInfo.appInfo == null) return;
+
         // replace any webservices with the webservice servlet
         // HACK: use a temp class loader because the class may have been loaded before
         // the openejb classes were added to the system class path so the WebService anntation
@@ -305,7 +312,6 @@
             Context comp = (Context) ContextBindings.getClassLoader().lookup("comp");
 
             // add context to WebDeploymentInfo
-            ContextInfo contextInfo = getContextInfo(standardContext);
             for (WebAppInfo webAppInfo : contextInfo.appInfo.webApps) {
                 if (("/" + webAppInfo.contextRoot).equals(standardContext.getPath())) {
                     CoreWebDeploymentInfo webDeploymentInfo = (CoreWebDeploymentInfo) getContainerSystem().getWebDeploymentInfo(webAppInfo.moduleId);
@@ -345,14 +351,14 @@
         if (standardContext.getServletContext().getAttribute(IGNORE_CONTEXT) != null) return;
 
         ContextInfo contextInfo = getContextInfo(standardContext);
-        if (contextInfo != null && contextInfo.deployer == null) {
+        if (contextInfo != null && contextInfo.appInfo != null && contextInfo.deployer
== null) {
             try {
                 assembler.destroyApplication(contextInfo.appInfo.jarPath);
             } catch (Exception e) {
                 logger.error("Unable to stop web application " + standardContext.getPath()
+ ": Exception: " + e.getMessage(), e);
             }
-            removeContextInfo(standardContext);
         }
+        removeContextInfo(standardContext);
     }
 
     public void destroy(StandardContext standardContext) {



Mime
View raw message