不幸的是,我对jasperreports很新,我必须修改现有的项目。 版本4.0.1
有些不对劲,但我无法弄清楚究竟是什么。
如果我想生成pdf(通过浏览器点击),则会出现异常:
org.xml.sax.SAXParseException: Attribute "width" was already specified for element "reportElement".
日志说:
[11/20/13 9:56:52:784 CET] 00000028 SystemOut O Parse Fatal Error at line 91 column 118: Attribute "width" was already specified for element "reportElement".
我剥离了原始源(删除了所有子报告等),但错误仍然存在。我不知道,哪个文件引用了"line 91 column 118".
搞笑:随机我删除了reportElement中的forecolor和backcolor属性,它有效(暂时)。有没有已知的错误?
怎么办?
很抱歉。所以这里有更多信息:
我正在使用IBM WebSphere AST,jasperreport 4.0.1,iReport 4.0.1和oracleDB。
My.jrxml的编译在大多数情况下都不起作用。 myController的:
JasperReport jasperReport = JasperCompileManager
.compileReport(getServletContext()
.getRealPath(
Configuration.reportPath()
+ "My.jrxml"));
错误:
[11/20/13 13:30:29:535 CET] 0000002e SystemOut O Parse Fatal Error at line 91 column 118: Attribute "width" was already specified for element "reportElement".
org.xml.sax.SAXParseException: Attribute "width" was already specified for element "reportElement".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(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.XMLNSDocumentScannerImpl.scanStartElement(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.commons.digester.Digester.parse(Digester.java:1745)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:241)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:228)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:216)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:170)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:154)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:146)
at com.my.tool.frontend.MyPdfController.handleDate(MyPdfController.java:673)
at com.my.tool.frontend.MyPdfController.doAction(MyPdfController.java:129)
at com.my.tool.frontend.helper.HelpController.doAuth(HelpController.java:519)
at com.my.tool.frontend.helper.HelpController.doGet(HelpController.java:255)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3107)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1425)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:92)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:193)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:725)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:847)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)
My.jrxml的第91行:
<reportElement key="staticText-4" x="0" y="167" width="535" height="45" forecolor="#000000" backcolor="#FFFFFF"/>
我希望这足够冗长...... 谢谢。