You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by pe...@apache.org on 2008/01/21 09:14:53 UTC

svn commit: r613788 - in /tomcat/container/tc5.5.x: modules/cluster/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java webapps/docs/changelog.xml

Author: pero
Date: Mon Jan 21 00:14:51 2008
New Revision: 613788

URL: http://svn.apache.org/viewvc?rev=613788&view=rev
Log:
Fix FarmWarDeployer can be only configured at host subelement

Modified:
    tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml

Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java?rev=613788&r1=613787&r2=613788&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java (original)
+++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java Mon Jan 21 00:14:51 2008
@@ -25,6 +25,7 @@
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
+import org.apache.catalina.Container;
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
 import org.apache.catalina.Host;
@@ -137,23 +138,36 @@
     public void start() throws Exception {
         if (started)
             return;
-        getCluster().addClusterListener(this);
-        if (watchEnabled) {
-            watcher = new WarWatcher(this, new File(getWatchDir()));
-            if (log.isInfoEnabled())
-                log.info("Cluster deployment is watching " + getWatchDir()
-                        + " for changes.");
+        Container hcontainer = getCluster().getContainer();
+        if(!(hcontainer instanceof Host)) {
+            log.error("FarmWarDeployer can only work as host cluster subelement!");
+            return ;
         }
-
         // Check to correct engine and host setup
-        host = (Host) getCluster().getContainer();
-        Engine engine = (Engine) host.getParent();
+        host = (Host) hcontainer;
+        Container econtainer = host.getParent();
+        if(econtainer == null && econtainer instanceof Engine) {
+            log.error("FarmWarDeployer can only work if parent of " + host.getName()+ " is an engine!"); 
+            return ;
+        }
+        Engine engine = (Engine) econtainer;
         try {
             oname = new ObjectName(engine.getName() + ":type=Deployer,host="
                     + host.getName());
         } catch (Exception e) {
             log.error("Can't construct MBean object name" + e);
+            return ;
         }
+        
+        if (watchEnabled) {
+            watcher = new WarWatcher(this, new File(getWatchDir()));
+            if (log.isInfoEnabled())
+                log.info("Cluster deployment is watching " + getWatchDir()
+                        + " for changes.");
+        }
+        
+        getCluster().addClusterListener(this);
+        
         configBase = new File(System.getProperty("catalina.base"), "conf");
         if (engine != null) {
             configBase = new File(configBase, engine.getName());

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=613788&r1=613787&r2=613788&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Mon Jan 21 00:14:51 2008
@@ -197,6 +197,9 @@
   <subsection name="Cluster">
     <changelog>
       <fix>
+        Fix FarmWarDeployer can be only configured at host subelement (pero)
+      </fix>
+      <fix>
       	Fix wrong &amp;&amp; at ReplicationValve (pero)
       </fix>
       <fix>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org