0 Replies Latest reply on Apr 4, 2007 1:22 AM by S Bass

    deploy J2EE application with JMX

    S Bass Newbie

      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!