使用birt、jsf和jsf4birt生成报告和图表
有谁能指导我使用jsf中BIRT在websphere/tomcat平台上使用jsf4birt生成的图表的步骤吗 我已经做了网站上提到的每一件事 但我还是得到了以下例外:使用birt、jsf和jsf4birt生成报告和图表,jsf,charts,report,birt,Jsf,Charts,Report,Birt,有谁能指导我使用jsf中BIRT在websphere/tomcat平台上使用jsf4birt生成的图表的步骤吗 我已经做了网站上提到的每一件事 但我还是得到了以下例外: SEVERE: JSF1054: (Phase ID: RENDER_RESPONSE 6, View ID: /workpages/pageb.jsp) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.fa
SEVERE: JSF1054: (Phase ID: RENDER_RESPONSE 6, View ID: /workpages/pageb.jsp) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@1f528ab]
Apr 18, 2012 8:04:16 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Faces Servlet threw exception
java.lang.NullPointerException
at org.eclipse.birt.report.engine.api.impl.ReportEngine$EngineExtensionManager.<init>(ReportEngine.java:819)
at org.eclipse.birt.report.engine.api.impl.ReportEngine.<init>(ReportEngine.java:111)
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory$1.run(ReportEngineFactory.java:18)
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory$1.run(ReportEngineFactory.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory.createReportEngine(ReportEngineFactory.java:14)
at com.exadel.jsfbirt.engine.BirtEngine.getBirtEngine(BirtEngine.java:80)
at com.exadel.jsfbirt.engine.BirtRendererUtils.renderBirt(BirtRendererUtils.java:134)
at com.exadel.jsfbirt.renderkit.html.BirtWrapperRenderer.doEncodeBegin(BirtWrapperRenderer.java:162)
at com.exadel.jsfbirt.renderkit.html.BirtWrapperRenderer.encodeBegin(BirtWrapperRenderer.java:127)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:813)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:928)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
此外,我还想知道以下上下文参数的含义,这些参数是根据网站链接添加到web.xml的:
<context-param>
<param-name>actuate.serverUrl</param-name>
<param-value>http://localhost:8900/iportal</param-value>
</context-param>
<context-param>
<param-name>actuate.serverLogin</param-name>
<param-value>administrator</param-value>
</context-param>
<context-param>
<param-name>actuate.serverPassword</param-name>
<param-value></param-value>
</context-param>
Finally the code worked for me. Steps to be followed are as follows :
1. Make a dynamic web project (jsf project if you want to use jsf tags).
2. Once your project is ready prepare your report. Prepare your data sets for report/chart generation, a sample query is mentioned below.
select count(customernumber) cuscount,State
from customers
where country=? -- this is the parameter you can give as input
group by state
3. Once you are done with this part add following parameters to web.xml
<context-param>
<param-name>actuate.serverUrl</param-name>
<param-value>http: localhost:8900 iportal</param-value>(please add //,/ respectively in the blank spaces.)
</context-param>
<context-param>
<param-name>actuate.serverLogin</param-name>
<param-value>administrator</param-value>
</context-param>
<context-param>
<param-name>actuate.serverPassword</param-name>
<param-value></param-value>
</context-param>
<context-param>
<param-name>org.eclipse.birt.configPath</param-name>
<param-value>**/configuration/config.ini**</param-value>
</context-param>
**Place the configuration folder inside WEB-CONTENT.**
If this is not done properly you can get null pointer exception.
4. Copy the "platform" folder inside WEB-INF.
5. The list of required jars are mentioned in the screen attached with this post.
(Downloading the dummy module of jsf4birt from exadel website will be helpful).
6. A tricky part that I found after struggling for few days. If you get **version mismatch error or unsupported exception**, open your reportfile.rptdesign in text editor u will get something like
<report xmlns="http //www.eclipse.org/birt/2005/design" **version="3.2.20"** id="1">
Change this version to the one that is supported by your server/IDE. I changed it from 3.2.23 to 3.2.20.
7. Finally the birt:birtWrapper worked for me. Where country is my parameter.
<birt:birtWrapper id="t" reportDesign="customerdetails.rptdesign" rendered="true">
<f:param name="country" value="#{form.country}"></f:param></birt:birtWrapper>
And then finally it worked for me.
I am trying to explore more features of BIRT like adding comments to a point on chart and generating reports in pdf format. Please do let me know if you are aware of these stuffs.