I'm trying to create an xml file.when I create the file I obtain this error. I don't really know what it is.it is a really strange error.the file is created correctly but nothing is written inside it.
Exception in thread "AWT-EventQueue-0" java.lang.AbstractMethodError: gnu.xml.dom.DomDocument.getXmlStandalone()Z
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.setDocumentInfo(DOM2TO.java:377)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:131)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:98)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:683)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:727)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:340)
at org.w3c.jigmonitor.controller.Controller.writePerformancesXmlFile(Controller.java:191)
at org.w3c.jigmonitor.controller.Controller.actionPerformed(Controller.java:68)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6505)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
at java.awt.Component.processEvent(Component.java:6270)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)
at java.awt.EventQueue.access$000(EventQueue.java:102)
at java.awt.EventQueue$3.run(EventQueue.java:662)
at java.awt.EventQueue$3.run(EventQueue.java:660)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:676)
at java.awt.EventQueue$4.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:673)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
this is the code I use to create xml file:
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
Element rootElement = doc.createElement("performances");
doc.appendChild(rootElement);
Attr attr = doc.createAttribute("date");
attr.setValue(dateFormat.format(cal.getTime()).toString());
rootElement.setAttributeNode(attr);
//Uptime
Element uptime = doc.createElement("uptime");
rootElement.appendChild(uptime);
Element days = doc.createElement("days");
days.appendChild(doc.createTextNode(new Long(duptime).toString()));
uptime.appendChild(days);
Element hours = doc.createElement("hours");
hours.appendChild(doc.createTextNode(new Long(huptime).toString()));
uptime.appendChild(hours);
Element minutes = doc.createElement("minutes");
minutes.appendChild(doc.createTextNode(new Long(muptime).toString()));
uptime.appendChild(minutes);
Element seconds = doc.createElement("seconds");
seconds.appendChild(doc.createTextNode(new Long(suptime).toString()));
uptime.appendChild(seconds);
//TotalHitCount
Element totalhitcount = doc.createElement("totalhitcount");
totalhitcount.appendChild(doc.createTextNode(new Long(stats.gettotal_hit_count()).toString()));
rootElement.appendChild(totalhitcount);
//EmittedBytes
Element emittedbytes = doc.createElement("emittedbytes");
emittedbytes.appendChild(doc.createTextNode(new Long(stats.getemitted_bytes()).toString()));
rootElement.appendChild(emittedbytes);
//Avghitsec
Element avghitsec = doc.createElement("avghitsec");
avghitsec.appendChild(doc.createTextNode(new Float(stats.getavg_hit_sec()).toString()));
rootElement.appendChild(avghitsec);
//Avgbyteshit
Element avgbyteshit = doc.createElement("avgbyteshit");
avgbyteshit.appendChild(doc.createTextNode(new Long(stats.getavgbytes_hit()).toString()));
rootElement.appendChild(avgbyteshit);
//Avgbps
Element avgbps = doc.createElement("avgbps");
avgbps.appendChild(doc.createTextNode(new Long(stats.getavgbps()).toString()));
rootElement.appendChild(avgbps);
//Total Threads
Element totalthreads = doc.createElement("totalthreads");
totalthreads.appendChild(doc.createTextNode(new Long(stats.gettotal_threads()).toString()));
rootElement.appendChild(totalthreads);
//Idle Threads
Element idlethreads = doc.createElement("idlethreads");
idlethreads.appendChild(doc.createTextNode(new Long(stats.getidle_threads()).toString()));
rootElement.appendChild(idlethreads);
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transfomer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(new File("/home/mazzy/Scrivania/perfor_"+dateFormat.format(cal.getTime()).toString()+".xml"));
transfomer.transform(source, result);
I got that exception in transfomer method.any idea what I got this error?