Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
NullPointerException --> Source not found for MappedRandomAccessFile.close()
pierrik
Hello everyone,<br />
<br />
I'm developing an web application. I'm using BIRT 2.2.1.1 + jdk 1.4 + MyEclipse<br />
<br />
I design my report with BIRT Designer in MyEclipse, and generate the report in a class java.<br />
<br />
Every time that I generate my report, and when the code runs until "<span style='color: #FF0000'>IRunAndRenderTask.run()</span>" the debug of MyEclipse pops-up, gives me a "<span style='color: #FF0000'>NullPointerException</span>" and "<span style='color: #FF0000'>Source not found for MappedRandomAccessFile.close() line: 173</span>".<br />
However, my report manages to report itself, and my thread is suspended.<br />
<br />
Here goes my code:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IsoException, IOException
{
String isolineProjectRepository = null;
Context initCtx;
try {
initCtx = new InitialContext();
Context envCtx = (Context ) initCtx.lookup("java:comp/env");
isolineProjectRepository = (String) envCtx.lookup("fileIsolineProjectRepository");
} catch (NamingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
response.setContentType("application/download");
response.setHeader("Content-disposition", "attachment; filename=" + pa.getCurrentProjectShortDenom() + "overview.pdf");
response.setHeader("pragma", "no-cache");
response.setHeader("cache-control", "no-cache");
response.setHeader("expires", "0");
OutputStream output = response.getOutputStream();
EngineConfig config = new EngineConfig();
config.setBIRTHome(isolineProjectRepository + "/ReportEngine");
config.setLogConfig(isolineProjectRepository + "/ReportEngine", Level.WARNING);
// Explicitly set up the stand-alone application
// Start the platform for a non-RCP application.
try {
Platform.startup(config);
} catch (BirtException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
IPDFRenderOption option = new PDFRenderOption();
option.setOutputFormat(PDFRenderOption.OUTPUT_FORMAT_PDF);
option.setOutputStream(output);
// Create the engine.
IReportEngine engine = factory.createReportEngine(config);
String designName = null;
if ("T".equals(pa.getProjectActivityType().getProjectActivityTypeShortName()))
{
designName = isolineProjectRepository + "/ActivityInfo.rptdesign";
}
else
{
designName = isolineProjectRepository + "/ProjectInfo.rptdesign";
}
IReportRunnable runnable = null;
try {
runnable = engine.openReportDesign(designName);
} catch (EngineException e) {
System.err.println("Design " + designName + " not found!");
engine.destroy();
}
// Get the value of parameters.
IRunAndRenderTask task = engine.createRunAndRenderTask(runnable);
task.setRenderOption(option);
try {
task.run();
} catch (EngineException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
task.close();
output.flush();
output.close();
return null;
}
</pre>
<br />
<br />
Could any one give my a hand? Waiting for you!<br />
Thanks a lot!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Find more posts tagged with
Comments
pierrik
any idea?
Thousands thanks!!!
Virgil Dodson
Hi pierrik, Im moving question about the BIRT Engine out of the Practice area and into the Deploying with BIRT Engine Forum so others there might know the answer.