第十六章 BIRT疑难杂惑清理

第十四十五章还在书写中,先就目前BIRT比较集中的一些疑难杂惑进行解决。

问题一:把runtime包中自带的birt.war发布到Tomcat6上,运行后,首页面可以显示,但当点击"

View Example "时,加载报表就报错.错误内容如下:


或者在运行过程中出现:Caused by: java.lang.OutOfMemoryError: PermGen space

问题原因:java.lang.OutOfMemoryError: PermGen space PermGen space的全称是Permanent Generation space,是指内存的永久保存区域, 这块内存主要是被JVM存放Class和Meta信息的,Class在被Loader时就会被放到PermGen space中, 它和存放类实例(Instance)的Heap区域不同,GC(Garbage Collection)不会在主程序运行期对 PermGen space进行清理,所以如果你的应用中有很多CLASS的话,就很可能出现PermGen space错误, 这种错误常见在web服务器对JSP进行pre compile的时候。如果你的WEB APP下都用了大量的第三方jar, 其大小超过了jvm默认的大小(4M)那么就会产生此错误信息了。

解决方法: 手动设置MaxPermSize大小修改TOMCAT_HOME/bin/catalina.sh 在“echo "Using CATALINA_BASE: $CATALINA_BASE"”上面加入以下行: JAVA_OPTS="-server -XX:PermSize=64M -XX:MaxPermSize=128m 或者set JAVA_OPTS=-Xms512m -Xmx1024m -XX:PermSize=128M -XX:MaxNewSize=256m -XX:MaxPermSize=256m

最佳实践:尽量用公用库,用户库只保留必须的极简化包。


问题二:集群环境访问报表出现birt the viewing session is not avaliable or has expired

问题描述:

http://11.23.26.3:8084/biReport/frameset?__report=VIP_kefu.rptdesign&__masterpage=true&__format=html&__parameterpage=true&__toolbar=true&__showtitle=false

我采用上面的url,在一个项目中访问另一个项目birtReport中的birt报表,发生错误:

birt the viewing session is not avaliable or has expired

问题原因:session 失效

BIRT源码中session来自如下这段代码:

public static final String GENERAL_ERROR_NO_VIEWING_SESSION = "birt.viewer.error.noviewingsession";

birt.viewer.error.noviewingsession=The viewing session is not available or has expired.

ViewingSessionUtil.getSession( request );

如果在WEB-INF\viewer.properties 进行了如下的设置

# [VIEWING SESSION CONFIGURATION]
# The BIRT viewing session is a sub-session of the HTTP session.
# An HTTP session can have multiple BIRT viewing sessions.
# Each time a new viewer is opened, a new viewing session is created. 
# The following parameters are used to configure the viewing session
# management.
# If the matching HTTP session expires, all the viewing sessions
# attached to it will expire as well.

# Timeout value in seconds after which a viewing session will expire.
# The value 0 means that a session will never expire, and the cached files
# will never be cleant unless the belonging HTTP session expires.
viewer.session.timeout=1800
# [VIEWING SESSION CONFIGURATION]
# The BIRT viewing session is a sub-session of the HTTP session.
# An HTTP session can have multiple BIRT viewing sessions.
# Each time a new viewer is opened, a new viewing session is created. 
# The following parameters are used to configure the viewing session
# management.
# If the matching HTTP session expires, all the viewing sessions
# attached to it will expire as well.
# Timeout value in seconds after which a viewing session will expire.
# The value 0 means that a session will never expire, and the cached files
# will never be cleant unless the belonging HTTP session expires.
viewer.session.timeout=1800
# Timeout value in seconds after which a viewing session will expire.
# The value 0 means that a session will never expire, and the cached files
# will never be cleant unless the belonging HTTP session expires.
viewer.session.timeout=1800

在tomcat或者weblogic中也设置了session timeout时间,依然不能解决这个问题,

那么需要设置你的IE,用cookie来保持session

方法如下:

IE - Intetnet 选项 - 隐私 - 设置:这里有个拉动条,可以设置IE的cookie。将它调到“低”或者“最低”,可以达到解决问题的目的。

但客户通常是懒惰的,这个时候还有一种方案,用hostname代替前面的IP来访问报表
http://bi2.query.com:8084/biReport/frameset?__report=VIP_kefu.rptdesign&__masterpage=true&__format=html&__parameterpage=true&__toolbar=true&__showtitle=false


问题三:javascript出现失效,自定义的javascript无法访问

解决方案:设置默认的render格式为html,注意在designer中的javascript路径和tomcat的javascript路径是不同的,尽量配置使用相对路径

 问题四:怎么自定义打印

问题描述:想不使用birtviewer提供的打印工具栏,自己在页面上或者定义一个工具栏,那么可以参考birtviewer提供的jsp页面自己写一份,也可以利用动态文本在html代码中书写如下内容的鼠标触发事件:

<script>
self.moveTo(622,722);
self.resizeTo(1,1);
document.execCommand('print','true','true');
window.opener="anyone";
window.close();
</script>
window.open(path + '/output?__report=/report/oms/report.rptdesign&orderId=' + orderId);

问题五:导出Excel出现空行

这是java类库在导出microsoft excel时出现的错误,根源不在BIRT,而在microsoft office的闭源,导致java excel类库不完善。

解决方案,先用html格式的render打印;在制作报表的时候,分组信息尽量不要单独成一行,表头表尾,单元格头尾尽量去掉。

后面还会继续就BIRT问题提供解决方案。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值