« 1 2» Pages: ( 1/2 total )
本页主题: 部署一个BIRT报告到你的应用服务器 打印 | 加为IE收藏 | 收藏主题 | 上一主题 | 下一主题

ko4java

状态: 离线
级别: CEC高级程序员
精华: 1
发帖: 12
威望: 12 点
财富: 223 元
在线时间:7(小时)
注册时间:2005-11-02
最后登录:2006-12-11

部署一个BIRT报告到你的应用服务器

最近使用BIRT作为自己项目中的报告生成工具,看到论坛上有很多朋友在部署时有问题。希望这篇文章对你有所帮助,基本以BIRT1.0.1的开发者文档翻译为主。2.0刚刚发布,还没有使用过。

这里主要介绍的是部署一个已经存在的BIRT报告,也就是说你已经设计好的.reptdesign文件,本文并不介绍如何设计BIRT报告。

Deploying a BIRT report to an application server

这里BIRT说明了目前版本没有在高于JRE1.4的环境中测试过,如果你需要发布到JRE1.5的环境中,可能会有问题。以下内容使用TOMCAT为例

1.Placing the BIRT report viewer on the application server

拷贝ECLIPSE_INSTALL/plugins/org.eclipse.birt.report.viewer_1.0.1/birt到你的$TOMCAT_INSTALL/webapps,这个BIRT其实就是一个完整web应用,不需要再添加什么JAR包了。你也可以通过在TOMCAT中指定目录<Context />来添加,具体内容可以查看文档。

2.Viewing a report using a browser

添加完birt的应用后,启动你的TOMCAT,然后你就可以通过浏览器访问BIRT。这里有2种方式

http://localhost:8080/birt/run?parameter_list
http://localhost:8080/birt/frameset?parameter_list

    2.1 Understanding the run servlet

如果使用run servlet,BIRT会显示一个单独的Web页面或者一个PDF文件

    2.2 Understanding the frameset servlet

如果使用frameset servlet,BIRT将会显示3个Frame,一个显示输入报告参数的表单,一个显示报告,一个显示导航条。

    2.3 Understanding the URL parameters

下表为servlet可以支持的参数,需要注意的是_frame参数仅对frame servlet有效,reportParam参数是指你自己的report中定义的参数。

Parameter
Values
Required/default
__report
path to report design file
Yes, no default
__format
html or pdf
Optional /default to html
__frame
true or false
Optional /default to true
__locale
locale
Optional /defaults to JVM locale
__navigation
hide or parameter
Optional /default to auto
__toolbar
true or false
Optional /default to true
__isnull
any user-defined report parameter values
Optional /no default value
reportParam
User-defined
As specified in the report design / As specified in the report design

          2.3.1 Understanding the __report parameter

__report参数有3种定义方式

a.绝对路径

http://localhost:8080/birt/run?__report=C:\myReport.rptdesign

你的rptdesin文件存放在C:\myReport.rptdesign

b.相对路径,但是你的web.xml中没有定义BIRT_VIEWER_REPORT_ROOT

http://localhost:8080/birt/run?__report=Report\myReport.rptdesign

你的rptdesin文件存放在$TOMCAT_INSTALLl\webapps\birt\Report\myReport.rptdesign

c.相对路径,但是你的web.xml中定义了BIRT_VIEWER_REPORT_ROOT为C:\Reports

http://localhost:8080/birt/run?__report=myReport.rptdesign

你的rptdesin文件存放在C:\Reports\myReport.rptdesign

其他的参数都很简单,就不一一介绍了。

部署的过程其实很简单,我遇到的问题主要有

1.路径不对

2.自定义参数未定义

3.__locale参数未加,显示中文有问题

4.所有参数前面是两个下划线

希望能对你的项目有所帮助。如有问题,请回复

ko4java

 

顶端 时间: 2006年01月26日 11:14 | [楼 主]
hcom

状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 14
威望: 12 点
财富: 214 元
在线时间:0(小时)
注册时间:2005-11-18
最后登录:2008-03-04

谢谢!!!!
顶端 时间: 2006年02月01日 22:42 | 1 楼
jerry_liukj

状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 3
威望: 11 点
财富: 204 元
在线时间:1(小时)
注册时间:2006-01-18
最后登录:2006-02-23

顶端 时间: 2006年02月22日 18:57 | 2 楼
romkk

状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 9
威望: 11 点
财富: 211 元
在线时间:2(小时)
注册时间:2005-12-16
最后登录:2007-11-07

谢谢楼主了.我正需要这样的文章!
顶端 时间: 2006年02月27日 09:00 | 3 楼
jerry_liukj

状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 3
威望: 11 点
财富: 204 元
在线时间:1(小时)
注册时间:2006-01-18
最后登录:2006-02-23

我在IE中输入
http://192.168.1.95:8080/birt/run__report=F:\workspace\iHRplus\new_report_2.rptdesign
显示的结果为
???????? F:\workspace\iHRplus\new_report_2.rptdesign?

__为两个下划线
new_report_2.rptdesign没有带parameter


请大家路过帮忙看看 是什么地方出问题了文字
顶端 时间: 2006年02月27日 17:35 | 4 楼
hunphy

状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 18
威望: 11 点
财富: 220 元
在线时间:6(小时)
注册时间:2006-02-05
最后登录:2006-06-01

谢谢LZ 对我很有帮助 谢谢
顶端 时间: 2006年03月01日 11:36 | 5 楼
sunnysong

状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 4
威望: 11 点
财富: 204 元
在线时间:0(小时)
注册时间:2006-03-29
最后登录:2006-08-10

谢谢lz!!!
顶端 时间: 2006年03月29日 15:03 | 6 楼
michael

状态: 离线
级别: CEC高级程序员
精华: 3
发帖: 19
威望: 19 点
财富: 253 元
在线时间:3(小时)
注册时间:2006-03-24
最后登录:2008-05-23

http://192.168.1.95:8080/birt/run__report=F:\workspace\iHRplus\new_report_2.rptdesign
路径不对,应该为:
http://192.168.1.95:8080/birt/run?__report=F:\workspace\iHRplus\new_report_2.rptdesign
在run的后面要有个“?”
顶端 时间: 2006年03月29日 17:28 | 7 楼
sunnysong

状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 4
威望: 11 点
财富: 204 元
在线时间:0(小时)
注册时间:2006-03-29
最后登录:2006-08-10

有没有人知道,birt report 除了deploy到web container, 还有其他deploy方式吗?

谢谢!
顶端 时间: 2006年04月06日 17:19 | 8 楼
bitizxf

状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 7
威望: 11 点
财富: 206 元
在线时间:0(小时)
注册时间:2006-04-22
最后登录:2008-09-09

恩,谢谢楼主,资料标记一下
顶端 时间: 2006年04月23日 22:13 | 9 楼
colintrue

状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 2
威望: 11 点
财富: 202 元
在线时间:2(小时)
注册时间:2006-04-18
最后登录:2007-04-20

现在已有应用$TOMCAT_INSTALL/webapps/myapp/,现在要求不能把BIRT的例子直接放到myapp下,而是放到myapp/report/下,以免引起原应用结构混乱。但运行失败!该如何修改呢?谢谢!
[ 此贴被colintrue在2006年04月24日 13:21重新编辑 ]
顶端 时间: 2006年04月24日 13:08 | 10 楼
krf301

状态: 离线
级别: CEC程序员
精华: 0
发帖: 314
威望: 15 点
财富: 1 元
在线时间:30(小时)
注册时间:2005-11-28
最后登录:2008-09-08

好文章!初学一天后就应该看到这里了。
顶端 时间: 2006年05月07日 14:53 | 11 楼
qqhelloworld

状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 3
威望: 1 点
财富: 103 元
在线时间:0(小时)
注册时间:2006-05-09
最后登录:2006-05-15

Quote:
引用第10楼colintrue2006年04月24日 13:08发表的“”:
现在已有应用$TOMCAT_INSTALL/webapps/myapp/,现在要求不能把BIRT的例子直接放到myapp下,而是放到myapp/report/下,以免引起原应用结构混乱。但运行失败!该如何修改呢?谢谢!


http://localhost:8080/birt-viewer/run?__report=Report\test.rptdesign
顶端 时间: 2006年05月09日 13:10 | 12 楼
krf301

状态: 离线
级别: CEC程序员
精华: 0
发帖: 314
威望: 15 点
财富: 1 元
在线时间:30(小时)
注册时间:2005-11-28
最后登录:2008-09-08

请问如何在tomcat中的web.xml中定义好相对路径,使BIRT_VIEWER_REPORT_ROOT为C:\Reports
这样以后就不用在地址栏打入:
http://localhost:8080/birt_viewer/frameset?__report=c:\reports\MyFirstReport.rptdesign
直接访问MyFirstReport.rptdesign
顶端 时间: 2006年05月09日 13:33 | 13 楼
javaflying

状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 3
威望: 1 点
财富: 103 元
在线时间:0(小时)
注册时间:2006-05-12
最后登录:2006-07-06

怎么都看不到啊
顶端 时间: 2006年05月18日 13:01 | 14 楼
nan_jia

状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 1
威望: 11 点
财富: 201 元
在线时间:1(小时)
注册时间:2006-04-03
最后登录:2008-06-17

顶端 时间: 2006年07月03日 14:07 | 15 楼
gackcolin

状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 16
威望: 1 点
财富: 122 元
在线时间:0(小时)
注册时间:2006-07-21
最后登录:2008-04-22

不行啊,大哥帮忙看一下:
description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet execution threw an exception


root cause

java.lang.NoSuchMethodError: org.osgi.service.packageadmin.PackageAdmin.getBundle(Ljava/lang/Class;)Lorg/osgi/framework/Bundle;
   org.eclipse.osgi.framework.internal.protocol.MultiplexingFactory.hasAuthority(MultiplexingFactory.java:141)
   org.eclipse.osgi.framework.internal.protocol.MultiplexingFactory.findAuthorizedFactory(MultiplexingFactory.java:118)
   org.eclipse.osgi.framework.internal.protocol.StreamHandlerFactory.findAuthorizedURLStreamHandler(StreamHandlerFactory.java:149)
   org.eclipse.osgi.framework.internal.protocol.StreamHandlerFactory.createURLStreamHandler(StreamHandlerFactory.java:91)
   java.net.URL.getURLStreamHandler(URL.java:1010)
   java.net.URL.<init>(URL.java:363)
   java.net.URL.<init>(URL.java:253)
   java.net.URL.<init>(URL.java:276)
   java.io.File.toURL(File.java:572)
   org.eclipse.birt.core.framework.osgi.OSGILauncher.startup(OSGILauncher.java:102)
   org.eclipse.birt.core.framework.Platform.startup(Platform.java:78)
   org.eclipse.birt.report.service.ReportEngineService.setEngineContext(Unknown Source)
   org.eclipse.birt.report.service.BirtViewerReportService.setContext(Unknown Source)
   org.eclipse.birt.report.servlet.BirtEngineServlet.__getContext(Unknown Source)
   org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGet(Unknown Source)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
   org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.
顶端 时间: 2006年08月09日 09:50 | 16 楼
gflei

状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 56
威望: 1 点
财富: 176 元
在线时间:0(小时)
注册时间:2006-09-18
最后登录:2007-11-28

Quote:
引用第13楼krf3012006年05月09日 13:33发表的“”:
请问如何在tomcat中的web.xml中定义好相对路径,使BIRT_VIEWER_REPORT_ROOT为C:Reports
这样以后就不用在地址栏打入:
http://localhost:8080/birt_viewer/frameset?__report=c:reportsMyFirstReport.rptdesign
直接访问MyFirstReport.rptdesign


搂住已经说过了,引用如下

Copy code
  2.3.1 Understanding the __report parameter

__report参数有3种定义方式

a.绝对路径

[url]http://localhost:8080/birt/run?__report=C:[/url]\myReport.rptdesign

你的rptdesin文件存放在C:\myReport.rptdesign

b.相对路径,但是你的web.xml中没有定义BIRT_VIEWER_REPORT_ROOT

[url]http://localhost:8080/birt/run?__report=Report[/url]\myReport.rptdesign

你的rptdesin文件存放在$TOMCAT_INSTALLl\webapps\birt\Report\myReport.rptdesign

c.相对路径,但是你的web.xml中定义了BIRT_VIEWER_REPORT_ROOT为C:\Reports

[url]http://localhost:8080/birt/run?__report=myReport.rptdesign[/url]

顶端 时间: 2006年09月19日 15:22 | 17 楼
gflei

状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 56
威望: 1 点
财富: 176 元
在线时间:0(小时)
注册时间:2006-09-18
最后登录:2007-11-28

Quote:

1.Placing the BIRT report viewer on the application server

拷贝ECLIPSE_INSTALL/plugins/org.eclipse.birt.report.viewer_1.0.1/birt到你的$TOMCAT_INSTALL/webapps,这个BIRT其实就是一个完整web应用,不需要再添加什么JAR包了。你也可以通过在TOMCAT中指定目录<Context />来添加,具体内容可以查看文档。



经验证上面的部署方法不妥当,会出现下面问题
    提示缺包
    $NO-RB$ Can't startup the OSGI framework


比较简单的部署方式
    下载 birt-runtime-2_1_0
    解开后,把birt.war放入应用服务器中
    测试


楼主的方式可能适合于高手来做。
顶端 时间: 2006年09月22日 11:44 | 18 楼
julycn

头衔:七月天 七月天
状态: 离线
级别: CEC高级程序员
精华: 0
发帖: 75
威望: 1 点
财富: 212 元
在线时间:0(小时)
注册时间:2006-06-26
最后登录:2008-02-25

好东西,一定要顶
顶端 时间: 2006年09月27日 15:51 | 19 楼
« 1 2» Pages: ( 1/2 total )
中国Eclipse社区 » 报表应用


辽ICP备05021625号