Fixed startup exception
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 17 Oct 2006 14:05:50 +0000 (14:05 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 17 Oct 2006 14:05:50 +0000 (14:05 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@464928 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/ha/deploy/FarmWarDeployer.java

index 78d88cb..fffbdc4 100644 (file)
@@ -142,12 +142,18 @@ public class FarmWarDeployer extends ClusterListener implements ClusterDeployer,
             watcher = new WarWatcher(this, new File(getWatchDir()));
             if (log.isInfoEnabled())
                 log.info("Cluster deployment is watching " + getWatchDir()
-                        + " for changes.");
+                         + " for changes.");
         }
-
+    
         // Check to correct engine and host setup
-        host = (Host) getCluster().getContainer();
-        Engine engine = (Engine) host.getParent();
+        Object parent = getCluster().getContainer();
+        Engine engine = null;
+        if ( parent instanceof Host ) {
+            host = (Host) parent;
+            engine = (Engine) host.getParent();
+        }else {
+            engine = (Engine)parent;
+        }
         try {
             oname = new ObjectName(engine.getName() + ":type=Deployer,host="
                     + host.getName());
@@ -157,8 +163,7 @@ public class FarmWarDeployer extends ClusterListener implements ClusterDeployer,
         configBase = new File(System.getProperty("catalina.base"), "conf");
         if (engine != null) {
             configBase = new File(configBase, engine.getName());
-        }
-        if (host != null) {
+        } else if (host != null) {
             configBase = new File(configBase, host.getName());
         }