List of usage examples for javax.xml.xpath XPathException printStackTrace
public void printStackTrace()
From source file:org.rhq.plugins.jbossas.util.WarDiscoveryHelper.java
/** * Try to get the context root from the ear file this war is embedded in * @param parentEARComponent the ApplicationComponent representing the EAR * @param parentJBossASComponent The JBossAS instance the ear is deployed in * @param warName THe name of the war file we are looking for * @return context root of the war file//from ww w .j av a 2 s. com */ private static String getContextRootFromEar(ApplicationComponent parentEARComponent, JBossASServerComponent<?> parentJBossASComponent, String warName) { String contextRoot = " - invalid - "; // Get the ear and then the deploymentDescriptor attribute from it - this directly contains the one and // only context-root String objectNameTemplate = "jboss.management.local:J2EEServer=Local,j2eeType=J2EEApplication,name=" + parentEARComponent.getApplicationName(); ObjectNameQueryUtility queryUtility = new ObjectNameQueryUtility(objectNameTemplate); List<EmsBean> mBeans = parentJBossASComponent.getEmsConnection() .queryBeans(queryUtility.getTranslatedQuery()); if (mBeans.size() == 1) { EmsBean theBean = mBeans.get(0); EmsAttribute ddAttr = theBean.getAttribute("deploymentDescriptor"); ddAttr.refresh(); ddAttr.getValue(); String dd = (String) ddAttr.getValue(); // dd contains application.xml InputSource is = new InputSource(new StringReader(dd)); XPath xp = XPathFactory.newInstance().newXPath(); try { contextRoot = xp.evaluate("/application/module/web/web-uri['" + warName + "']/../context-root", is); } catch (XPathException xpe) { xpe.printStackTrace(); // TODO fix this } } return contextRoot; }