我有一个项目,我正在使用jasper报告来创建报告,我使用的是4.2版本。
当我在tomcat上运行这个项目时它运行正常,但是当在weblogic上部署相同时,我得到以下错误:
2017-01-23 19:40:18,520 ERROR [org.apache.commons.digester.Digester] - <Parse Error at line 2 column 434: Document root element "jasperReport", must match DOCTYPE root "null".>
org.xml.sax.SAXParseException: Document root element "jasperReport", must match DOCTYPE root "null".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1892)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:239)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:226)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:214)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:168)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:152)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:150)
答案 0 :(得分:0)
Weblogic正在使用自己的旧版jasper报告jar。 我尝试通过在weblogic.xml中添加以下代码来配置我的war文件应该使用自己的jar,
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
但它不起作用 我通过在weblogic服务器上添加新版本的jasperreport jar解决了这个问题,并给出了相同的类路径。