[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[birt-report-engine-dev] NullPointerException at ExecutorManager.java 274
|
Any report that I execute results in a NullPointer exception at ExecutorManager.java: 274.
Report Engine: 2.2.1
Container: Jetty
My Engine is initialized as follows:
EngineConfig config = new EngineConfig();
config.setEngineHome( "" );
config.setLogConfig(null, Level.ALL );
IPlatformContext servletContext = new PlatformServletContext( context );
config.setPlatformContext(servletContext);
config.setResourcePath( BIRT_VIEWER_SCRIPTLIB_DIR );
config.setProperty( "BIRT_VIEWER_SCRIPTLIB_DIR", BIRT_VIEWER_SCRIPTLIB_DIR );
Platform.startup(config);
IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
engine = factory.createReportEngine(config);
The last line executed by my code is:
runTask.run( docFileName );
I can see that the run task is creating an output file and data is being written to it. The stacktrace from the BIRT Engine:
org.eclipse.birt.data.engine.impl.DataEngineImpl <init>
Data Engine starts up
org.eclipse.birt.report.engine.extension.internal.ExtensionManager createReportItemExecutor
WARNING: Create Report Item Executor fail, Config not exist class: reportItem
org.eclipse.birt.report.engine.api.impl.RunTask doRun
SEVERE: An error happened while running the report. Cause:
java.lang.NullPointerException
at org.eclipse.birt.report.engine.executor.ExecutorManager$ExecutorFactory.visitExtendedItem(ExecutorManager.java:274)
at org.eclipse.birt.report.engine.ir.ExtendedItemDesign.accept(ExtendedItemDesign.java:45)
at org.eclipse.birt.report.engine.executor.ExecutorManager$ExecutorFactory.createExecutor(ExecutorManager.java:246)
Looking at ExecutorManager:274
273: IReportItemExecutor executor = ExtensionManager.getInstance( ).createReportItemExecutor( ExecutorManager.this, tagName );
274: executor.setContext( executorContext );
It appears that the null pointer exception is caused by callint setContext on a null IReportItemExecutor object.
Looking into ExtensionManager.createReportItemExecutor:
140: IConfigurationElement config = (IConfigurationElement) generationExtensions.get( itemType );
142: if ( config != null )
143 {
144 Object object = createObject( config, "class" ); //$NON-NLS-1$
145 if ( object instanceof IReportItemExecutor )
146 {
147 return (IReportItemExecutor) object;
148 }
149 else if ( object instanceof IReportItemGeneration )
150 {
151 return new ExtendedGenerateExecutor( manager,
152 (IReportItemGeneration) object );
153 }
154 logger
155 .log(
156 Level.WARNING,
157 "Create Report Item Executor fail, Config not exist class: {0}", config.getName( ) ); //$NON-NLS-1$
158 return null;
159 }
The last log line above is where I was getting the error I pasted in my previous post. That means that this method is returning null.( Perhaps it would be good practice for ExecutorManager to check for null after its call to ExtensionManager in order to avoid the NullPointerException? ) So why am I getting null from ExtensionManager? Looking into the variable *generationExtensions*, its a HashMap thats populated in the method ExtensionManager.loadGenerationExtensionDefns. Here is the body of this method:
337 protected void loadGenerationExtensionDefns()
338 {
339 IExtensionRegistry registry = Platform.getExtensionRegistry();
340 IExtensionPoint extPoint = registry.getExtensionPoint(EXTENSION_POINT_GENERATION);
341 if(extPoint==null)
342 return;
343
344 IExtension[] exts = extPoint.getExtensions();
345 logger.log(Level.FINE, "Start load extension point: {0}", EXTENSION_POINT_GENERATION); //$NON-NLS-1$
346 for (int i = 0; i < exts.length; i++)
347 {
348 IConfigurationElement[] configs = exts[i].getConfigurationElements();
349 for (int j = 0; j < configs.length; j++)
350 {
351 String itemName = configs[j].getAttribute("name"); //$NON-NLS-1$
352 generationExtensions.put(itemName, configs[j]);
353 logger.log(Level.FINE, "Load generation extension: {0}", itemName); //$NON-NLS-1$
354 }
355 }
356 }
So it looks like something is missing ( from the error above, I'd say "reportItem" ) from the exts array.
Any ideas?