Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Implement a Dynamic Tomcat Cluster with Mod_Cluster-3 : Page 3


advertisement

Dynamic Clustering in Apache Application Server

To enable dynamic clustering in Apache Application Server, JMS is required. Java Messaging System (JMS) communicates with the server through messaging and is used for configuring server properties dynamically without restarting the server system. The following code snippet gives the option for enabling clustering with Apache Web Server:

Registry registry =Registry.getRegistry(); MBeanServer mBeanServer = Registry.getRegistry().getServer() String beans[]=registry.findManagedBeans(); ManagedBean mbeanProxy = registry.findManagedBean("org.jboss.modcluster.ModClusterListener"); ClassNameMBean mbean= new ClassNameMBean(); mbean.setManagedBean(mbeanProxy); OperationInfo info[] = mbeanProxy.getOperations() ; for(int i=0;i-1){ OperationInfo opinfo=info[i]; ParameterInfo param[]=opinfo.getSignature(); Object params[] = {"localhost",9999}; String sig[] = {"java.lang.String","int"}; mbeanProxy.getInvoke("addProxy",params,sig,mbean,null); } }

Dynamically Deploying/Undeploying Apps in Tomcat



The following code snippet is for deploying Web applications in Tomcat:

DeployTask dt = new DeployTask(); dt.setUrl("http://localhost:8080/manager"); dt.setUsername("admin"); dt.setPassword("admin"); dt.setPath("/examples11"); dt.setWar("d:/cas-cert/examples1/examples11.war"); dt.execute();

The following code snippet is for undeploying Web applications in Tomcat.

UndeployTask udt = new UndeployTask(); udt.setUrl("http://localhost:8080/manager"); udt.setUsername("admin"); udt.setPassword("admin"); //http://localhost:8080/manager/undeploy?path=/examples11 udt.setPath("/examples11"); udt.execute(); : : : : :



Sivakumar Kuppusamy is a product technical lead involved in the design and development of Java EE applications.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap