报错信息例如以下:
-
There is no report design object available.
出现了这个错误顿时晕了,因为刚接触birt报表。不知道从那里入手,后经过百度和请教人,总结了例如以下的解决方法:
org.eclipse.birt.report.exception.ViewerException: There is no report design object available. at org.eclipse.birt.report.context.ViewerAttributeBean.__init(ViewerAttributeBean.java:226) at org.eclipse.birt.report.context.BaseAttributeBean.init(BaseAttributeBean.java:233) at org.eclipse.birt.report.context.ViewerAttributeBean.<init>(ViewerAttributeBean.java:118) at org.eclipse.birt.report.context.BirtContext.__init(BirtContext.java:44) at org.eclipse.birt.report.context.BaseContext.<init>(BaseContext.java:69) at org.eclipse.birt.report.context.BirtContext.<init>(BirtContext.java:30) at org.eclipse.birt.report.servlet.ViewerServlet.__getContext(ViewerServlet.java:150) at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doGet(BirtSoapMessageDispatcherServlet.java:151) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:177) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Unknown Source)
因为公司创建birt报表的版本号较低为2.6.2,我如今用的是4.4.2版本号。因为版本号不一致引起的错误。注意报表文件的开头:
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1"> <property name="comments">版权全部 (c) 2006 <<此处是您公司的名称>></property> <property name="createdBy">Eclipse BIRT Designer Version 4.4.2.v201410272105 Build <4.4.2.v20150217-1805></property>report节点的属性version的值为:3.2.23。此时我用的birt的版本号为4.4.2(version相应为3.2.23),而公司用的是2.6.2(version相应为3.2.22)。仅仅须要将version的值改动为低版本号即可(3.2.22)即可,只是建议改动下name="createBy"的property节点的文本值(这个修不改动都不会报错的),改为曾经的文本值(改动birt报表文件之前建议将这个值先保存下来)。避免发生混淆。改动后例如以下:
<?xml version="1.0" encoding="UTF-8"?> <report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.22" id="1"> <property name="comments">版权全部 (c) 2006 <<此处是您公司的名称>></property> <property name="createdBy">Eclipse BIRT Designer Version 2.6.2.r262_v20110209 Build <2.6.2.v20110214-1523></property>这些改动应该依据你自己的实际情况进行改动,上面仅仅是以我自己的为例。