Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


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




Building the Right Environment to Support AI, Machine Learning and Deep Learning

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.



Thanks for your registration, follow us on our social networks to keep up-to-date