Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Exception When Trying to Display a Report Multiple Times in WebLogic 10.3
mattsbr627
I have successfully been able to integrate BIRT into our WebLogic 10.3 application using the BIRT API. I'm able to generate reports to either HTML or PDF. However, when I attempt to execute my report more than once, I get some exceptions and the export fails. I believe this must be an issue of a resource I am not releasing, as it always works exactly one time after I restart my server. I'm using JNDI for my data source in my report file. Any ideas would be greatly appreciated!<br />
<br />
Thanks,<br />
Matt<br />
<br />
Here are the exceptions:<br />
(I've only included the first few lines of each stack trace for simplicity. Let me know if more info is required.)<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>Jun 29, 2010 3:53:01 PM org.eclipse.birt.data.engine.odaconsumer.ConnectionManag
er openConnection
SEVERE: Unable to open connection.
org.eclipse.birt.report.data.oda.jdbc.JDBCException: Missing properties in Conne
ction.open(Properties).
at org.eclipse.birt.report.data.oda.jdbc.Connection.open(Connection.java
:157)
at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaConnection.
open(OdaConnection.java:239)
at org.eclipse.birt.data.engine.odaconsumer.ConnectionManager.openConnec
tion(ConnectionManager.java:165)
at org.eclipse.birt.data.engine.executor.DataSource.newConnection(DataSo
urce.java:190)
at org.eclipse.birt.data.engine.executor.DataSource.open(DataSource.java
:178)
</pre>
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>Jun 29, 2010 3:53:01 PM org.eclipse.birt.report.engine.executor.ExtendedGenerate
Executor execute
SEVERE: An exception occurred during processing. Please see the following messag
e for details:
Cannot open the connection for the driver: org.eclipse.birt.report.data.oda.jdbc
.
Missing properties in Connection.open(Properties).
org.eclipse.birt.report.data.adapter.api.AdapterException: An exception occurred
during processing. Please see the following message for details:
Cannot open the connection for the driver: org.eclipse.birt.report.data.oda.jdbc
.
Missing properties in Connection.open(Properties).
at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.exec
ute(DataRequestSessionImpl.java:580)
at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(
DteDataEngine.java:152)
at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(Ab
stractDataEngine.java:265)
at org.eclipse.birt.report.engine.executor.ExtendedGenerateExecutor.exec
uteQueries(ExtendedGenerateExecutor.java:205)
at org.eclipse.birt.report.engine.executor.ExtendedGenerateExecutor.exec
ute(ExtendedGenerateExecutor.java:65)
at org.eclipse.birt.report.engine.executor.ExtendedItemExecutor.execute(
ExtendedItemExecutor.java:62)
at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicat
eItemExecutor.execute(SuppressDuplicateItemExecutor.java:43)</pre>
<br />
Here is the sourcecode I am using to try to export the HTML (PDF is very similar):<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>public static String executeReport(String reportFileName) throws EngineException {
IReportEngine engine=null;
EngineConfig config = null;
String reportHtml = "";
try {
config = new EngineConfig();
config.setBIRTHome(EJBUtility.getProperty("C:\\birt-runtime-2_5_2\\ReportEngine"));
config.setLogConfig(EJBUtility.getProperty("c:/temp/test"), Level.INFO);
Platform.startup( config );
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
engine = factory.createReportEngine( config );
IReportRunnable design = null;
//Open the report design
design = engine.openReportDesign(EJBUtility.getProperty("./reports/") + reportFileName);
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_HTML);
options.setEmbeddable(true);
options.setImageDirectory(EJBUtility.getProperty("./applications/domain/birtoutput/images/"));
options.setBaseImageURL(EJBUtility.getProperty("../../birtoutput/images/"));
options.setImageHandler(new HTMLServerImageHandler());
options.setActionHandler(new HTMLActionHandler());
ByteArrayOutputStream stringOutput = new ByteArrayOutputStream();
options.setOutputStream(stringOutput);
task.setRenderOption(options);
task.run();
reportHtml = stringOutput.toString();
stringOutput.close();
task.close();
engine.destroy();
} catch (Exception ex){
ex.printStackTrace();
} finally {
Platform.shutdown();
}
return reportHtml;
}</pre>
Find more posts tagged with
Comments
JasonW
It looks like you are trying to start and shutdown the platform for every request. You should only startup the platform once and shut it down with the app is shutdown. Take a look at this link for an example:
http://wiki.eclipse.org/Servlet_Example_(BIRT)_2.1
Look at the bottom of the link for 2.5 code.
Jason
johnw
Its easier to initialize the Platform as Jason suggested in the init() method for your servlet. Then you just build a task and run.
If your doing multiple executions of the same report, its also convenient to do a Run then Render task. Then, you can take the resulting rptDocument file, and use it in two separate render tasks to HTML or PDF without needing to rerun the report.
Just a design suggestion.
John
mattsbr627
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="66038" data-time="1277907050" data-date="30 June 2010 - 07:10 AM"><p>
It looks like you are trying to start and shutdown the platform for every request. You should only startup the platform once and shut it down with the app is shutdown. Take a look at this link for an example:<br />
<a class='bbc_url' href='
http://wiki.eclipse.org/Servlet_Example_(BIRT)_2.1'>http://wiki.eclipse.org/Servlet_Example_(BIRT)_2.1</a><br
/>
Look at the bottom of the link for 2.5 code.<br />
<br />
Jason<br /></p></blockquote>
<br />
Hi Jason - <br />
<br />
Thanks for the prompt and helpful reply. That fixed me right up!<br />
<br />
Matt