10 Replies Latest reply on Aug 12, 2010 8:13 AM by Vivek Srivastav

    How to read a file from inside of a deployed war

    Vivek Srivastav Newbie

      I am trying to access war archive from within a JMX MBean. I need to read a specific file I am adding within my war files. I need access to this information from the MBean.


      How can I access the deployed war files. Some of them are deployed within ear files.


                  Context ctx = new javax.naming.InitialContext();
                  ObjectName obj = new ObjectName("jboss.web.deployment:*");
                  MBeanServerConnection c = (MBeanServerConnection) ctx.lookup("jmx/invoker/RMIAdaptor");
                  Set<ObjectInstance> set = c.queryMBeans(obj, null);
                  log.info("Deploy dir is : " + deployDir);
                  String ps = System.getProperty("file.separator");
                  for (ObjectInstance oi : set) {
                      String tmpStr = oi.getObjectName().getCanonicalName();