[jboss-user] [Management, JMX/JBoss] - deploy J2EE application with JMX

syh_2ty do-not-reply at jboss.com
Wed Apr 4 01:22:21 EDT 2007


First , my jboss is 4.2.0, and I want to deploy my J2EE application with JBoss jmx,my code like this:
try{
         Context ctx=new InitialContext(env);
         RMIAdaptor server = (RMIAdaptor) ctx.look("jmx/rmi/RMIAdaptor");
         ObjectName name = new ObjectName  ("jboss.system:service=MainDeployer");
          MBeanInfo info=server.getMBeanInfo(name);
          MBeanOperationInfo[] operations=info.getOperations();
          for(int i=0;i<operations.length;i++)
          {
            	if(operations.getName().equals("deploy"))
            	{
            		MBeanParameterInfo[] pinfo=operations .getSignature();
            		for(int j=0;j<pinfo.length;j++)
            		{
            		      if(pinfo[j].getType().equals("java.net.URL"))
            		      {
            		        URL path=new URL("file:D:/application/Tomcat 5.5/webapps/test.war");
            		        server.invoke(name, "deploy", new Object[]{path}, new String[]{"java.net.URL"});
            		      }
            		}
            	 }
            	
            }
}
catch(Exception e)
{
        e.printStackTrace();
}
Is it right?And Is there a better way to do like this?Please help me,thanks!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034388#4034388

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034388



More information about the jboss-user mailing list