Skip to main content



      Home
Home » Archived » BIRT » NPE when added chart
NPE when added chart [message #1386676] Thu, 19 June 2014 07:51 Go to next message
Eclipse UserFriend
Hi,
in my RAP application used BIRT reports. My report is not work when added chart. In BIRT persepcive preview report show good(image 1.png). When report formed from RAP I give NPE. Without chart report show good from RAP application (image 2.png).
What am I doing wrong?

SEVERE: An error happened while running the report. Cause:
java.lang.NullPointerException
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.processExtendedContent(LocalizedContentVisitor.java:980)
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localizeForeign(LocalizedContentVisitor.java:591)
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localize(LocalizedContentVisitor.java:176)
at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:37)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:181)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)

My call procedure:
EngineConfig config = null;
IReportEngine engine = null;
IReportRunnable design = null;
IRunAndRenderTask task;
URL url = getReportURL(reportMnemonic);
config = new EngineConfig();
IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
engine = factory.createReportEngine(config);
InputStream fs = null;
try {
fs = url.openStream();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
design = engine.openReportDesign(fs);
setConnectionProperties(design);
task = engine.createRunAndRenderTask(design);

HTMLRenderOption renderOptions = new HTMLRenderOption();
renderOptions.setOutputFormat(HTMLRenderOption.HTML);
renderOptions.setOutputStream(outputStream);
renderOptions.setImageDirectory(System.getProperty("java.io.tmpdir"));
renderOptions.setSupportedImageFormats("PNG");
HTMLServerImageHandler imageHandler = new HTMLServerImageHandler() {

@Override
public String onCustomImage(IImage image, Object context) {
return registerImage(image, context);
}

@Override
public String onDesignImage(IImage image, IReportContext context) {
super.onDocImage(image, context);
return "/" + registerImage(image, context);
}

@Override
public String onDocImage(IImage image, IReportContext context) {
super.onDocImage(image, context);
return "/" + registerImage(image, context);
}

private String registerImage(IImage image, Object context) {
byte[] imageData = image.getImageData();
ByteArrayInputStream imageDatainputStream = new ByteArrayInputStream(imageData);
String fileName = image.getID();
RWT.getApplicationContext().getResourceManager().register(fileName, imageDatainputStream);
try {
imageDatainputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
return fileName;
}

};
renderOptions.setImageHandler(imageHandler);

task.setRenderOption(renderOptions);

task.run();
task.close();
engine.destroy();
return outputStream;
Re: NPE when added chart [message #1386885 is a reply to message #1386676] Sun, 22 June 2014 09:04 Go to previous messageGo to next message
Eclipse UserFriend
no ideas?
Re: NPE when added chart [message #1386927 is a reply to message #1386885] Mon, 23 June 2014 03:14 Go to previous messageGo to next message
Eclipse UserFriend
Which birt version do you use?
I read source code of birt 4.3.2, seems the LocalizedContentVisitor.java should not throw out exception at line #980. Maybe the NPE was caused by failure to init chart plugins in your environment.
Re: NPE when added chart [message #1386943 is a reply to message #1386927] Mon, 23 June 2014 04:33 Go to previous messageGo to next message
Eclipse UserFriend
Yes, version 4.3.2
Re: NPE when added chart [message #1395810 is a reply to message #1386943] Mon, 07 July 2014 08:27 Go to previous message
Eclipse UserFriend
Hi,
I had a similar problem and found out that I was missing the following dependencies:

org.eclipse.birt.chart.reportitem,
org.eclipse.birt.chart.engine.extension,
org.eclipse.birt.chart.device.extension,


Please check if adding those to your MANIFEST.MF helps you.

regards,
Łukasz
Previous Topic:PDF and barcode generation through iText
Next Topic:Special kind of bar chart - possible in BIRT?
Goto Forum:
  


Current Time: Sat Jul 12 15:50:11 EDT 2025

Powered by FUDForum. Page generated in 0.23957 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top