Nullpointer exception

Bala
Bala Member
edited February 11, 2022 in Analytics #1
All,

I am able to generate reports from eclipse/tomcat workspace. The same deployed in server (unix) enviroment but I am getting exception while generating report.

Here is the piece of code:
config.setEngineHome(properties.getProperty(REPORT_ENGINE_HOME));
config.setLogConfig(null,, Level.ALL);

try {
Platform.startup(config);
} catch (BirtException bex) {
LOG.error("Exception occured while running BIRT command Platform.startup()");
}
IReportEngineFactory factory = null;
try{
factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
System.err.println("factory is "+factory);

} catch(Exception ex){
ex.printStackTrace();
}

Here I am setting enginehome property from property file, It is working fine in local workspace and the factory (IReportEngineFactory) is getting null in server environment.

Please help to solve this problem.

Thanks & Regards,
Bala Labhishetty

Comments

  • rmurphy
    rmurphy Member
    edited December 31, 1969 #2
    Is the REPORT_ENGINE_HOME property updated when you move to your Unix environment? Does the user running the instance on the Unix environment have appropriate permissions on the Unix file system?

    Rob
  • Bala
    Bala Member
    edited December 31, 1969 #3
    Rob,

    Thanks for your posting. REPORT_ENGINE_HOME is updated in unix environment. One more update is i have tested in Unix(Solaris) and it is not working due to null pointer exception. But the same thing it is working in our UAT environment that is AIX.

    I am not sure what the problem is in Solaris.

    Thanks & Regards,
    Bala Labhishetty
  • rmurphy
    rmurphy Member
    edited December 31, 1969 #4
    Did you verify file system permissions? What does the stack trace look like?
  • michi85
    michi85 Member
    edited December 31, 1969 #5
    Hi,
    i have the same problem. I also got an null pointer exception when i run the BIRT Engine under Solaris.
    Under Windows are no problems.

    User which runs the tomcat has full permissions to the directorys.
    Are there any special rights needed?

    Does anybody have some experience?
    Could there any firewall problems?? The Solaris machine is running in a high-security environment.
  • rmurphy
    rmurphy Member
    edited December 31, 1969 #6
    What does the stack trace look like?

    Rob
  • jonwill
    jonwill Member
    edited December 31, 1969 #7
    hi,
    i' trying to create one rptdesign file containing a simple BarChart, but im facing some difficulties.
    the error is :

    java.lang.NullPointerException
    at org.eclipse.birt.chart.factory.Generator.getRowExpressions(Generator.java:1717)
    at org.eclipse.birt.chart.factory.Generator.getRowExpressions(Generator.java:510)
    at org.eclipse.birt.chart.reportitem.ChartReportItemImpl.getRowExpressions(ChartReportItemImpl.java:806)
    at org.eclipse.birt.report.model.util.BoundColumnsMgr.dealExtendedItem(BoundColumnsMgr.java:217)
    at org.eclipse.birt.report.model.writer.BoundColumnsWriterMgr.dealExtendedItem(BoundColumnsWriterMgr.java:425)
    at org.eclipse.birt.report.model.writer.ModuleWriter.visitExtendedItem(ModuleWriter.java:1664)
    at org.eclipse.birt.report.model.elements.ExtendedItem.apply(ExtendedItem.java:137)
    at org.eclipse.birt.report.model.writer.ModuleWriter.writeContents(ModuleWriter.java:2620)
    at org.eclipse.birt.report.model.writer.ModuleWriter.writeContents(ModuleWriter.java:2641)
    at org.eclipse.birt.report.model.writer.DesignWriter.visitReportDesign(DesignWriter.java:140)
    at org.eclipse.birt.report.model.elements.ReportDesign.apply(ReportDesign.java:89)
    at org.eclipse.birt.report.model.writer.ModuleWriter.writeFile(ModuleWriter.java:306)
    at org.eclipse.birt.report.model.writer.ModuleWriter.write(ModuleWriter.java:272)
    at org.eclipse.birt.report.model.api.ModuleHandle.save(ModuleHandle.java:1539)
    at org.eclipse.birt.report.model.api.ModuleHandle.saveAs(ModuleHandle.java:1559)
    at com.soft2tec.test.ChartReportApp.build(ChartReportApp.java:191)
    at com.soft2tec.test.ChartReportApp.main(ChartReportApp.java:70)


    Und hier is my code :

    import java.io.IOException;
    import java.util.HashMap;
    import org.eclipse.birt.report.engine.api.*;
    import org.eclipse.birt.report.engine.api.script.element.IReportItem;
    import org.eclipse.birt.report.model.api.CellHandle;
    import org.eclipse.birt.report.model.api.DesignConfig;
    import org.eclipse.birt.report.model.api.DesignElementHandle;
    import org.eclipse.birt.report.model.api.DesignEngine;
    import org.eclipse.birt.report.model.api.DesignFileException;
    import org.eclipse.birt.report.model.api.ElementFactory;
    import org.eclipse.birt.report.model.api.ExtendedItemHandle;
    import org.eclipse.birt.report.model.api.IDesignEngine;
    import org.eclipse.birt.report.model.api.IDesignEngineFactory;
    import org.eclipse.birt.report.model.api.LabelHandle;
    import org.eclipse.birt.report.model.api.ListHandle;
    import org.eclipse.birt.report.model.api.OdaDataSetHandle;
    import org.eclipse.birt.report.model.api.ReportDesignHandle;
    import org.eclipse.birt.report.model.api.RowHandle;
    import org.eclipse.birt.report.model.api.SessionHandle;
    import org.eclipse.birt.report.model.api.TableHandle;
    import org.eclipse.birt.report.model.api.activity.SemanticException;
    import org.eclipse.birt.report.model.api.command.ContentException;
    import org.eclipse.birt.report.model.api.command.NameException;
    import org.eclipse.birt.report.model.api.extension.ExtendedElementException;
    import org.eclipse.birt.report.model.api.extension.ReportItem;
    import org.eclipse.birt.chart.model.*;
    import org.eclipse.birt.chart.model.attribute.*;
    import org.eclipse.birt.chart.model.attribute.impl.*;
    import org.eclipse.birt.chart.model.component.*;
    import org.eclipse.birt.chart.model.component.impl.*;
    import org.eclipse.birt.chart.model.data.*;
    import org.eclipse.birt.chart.model.data.impl.*;
    import org.eclipse.birt.chart.model.impl.ChartWithAxesImpl;
    import org.eclipse.birt.chart.model.layout.*;
    import org.eclipse.birt.chart.model.type.*;
    import org.eclipse.birt.chart.model.type.impl.*;
    import org.eclipse.birt.chart.reportitem.*;
    import org.eclipse.birt.core.framework.Platform;

    import com.ibm.icu.util.ULocale;
    /**
    * Reads a BIRT report design file, adds a chart and writes a
    * new report design file containing the added chart.
    * Run this application with the following command line:
    * java ChartReportApp origDesing modifiedDesign
    */



    public class ChartReportApp
    {
    private DesignConfig config;
    //Konstruktor
    public ChartReportApp(){
    // Get an EngineConfig object with which to specify
    // the home of the BIRT report engine.
    config = new DesignConfig( );
    // Alter this path to the location of your Eclipse
    // installation.
    config.setProperty("BIRT_HOME", "/Users/williamsiakam/Desktop/birt-runtime-2_3_1/ReportEngine");

    }

    //main methode
    public static void main(String [] args){
    ChartReportApp cra = new ChartReportApp();
    try {
    cra.build();
    } catch (SemanticException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }

    public void build()throws IOException, SemanticException{

    //BIRT Initializations
    IDesignEngine engine = null;
    try{

    Platform.startup (config);
    IDesignEngineFactory factory = (IDesignEngineFactory) Platform
    .createFactoryObject( IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY );
    engine = factory.createDesignEngine( config );

    }catch( Exception ex){
    ex.printStackTrace();
    }

    SessionHandle session = engine.newSessionHandle( ULocale.ENGLISH ) ;

    ReportDesignHandle design = session.createDesign();

    // The element factory creates instances of the various BIRT elements.

    ElementFactory factory = design.getElementFactory( );
    DesignElementHandle element = factory.newSimpleMasterPage( "Page Master" ); //$NON-NLS-1$
    design.getMasterPages( ).add( element );


    // Creaate a new chart instance object
    ChartWithAxes cwaBar = ChartWithAxesImpl.create( );

    /* Plot */
    cwaBar.getBlock( ).
    setBackground( ColorDefinitionImpl.WHITE( ) );
    cwaBar.getBlock( ).getOutline( ).setVisible( true );
    Plot p = cwaBar.getPlot( );
    p.getClientArea( ).
    setBackground(ColorDefinitionImpl.create( 255,255,225 ) );
    p.getOutline( ).setVisible( false );

    /* Title */
    cwaBar.getTitle( ).getLabel( ).getCaption( ).
    setValue( "Bar Chart" );

    /* Legend */
    Legend lg = cwaBar.getLegend( );
    lg.getText( ).getFont( ).setSize( 16 );
    lg.setItemType( LegendItemType.CATEGORIES_LITERAL );

    /* X-Axis */
    Axis xAxisPrimary = cwaBar.getPrimaryBaseAxes( )[0];
    xAxisPrimary.setType( AxisType.TEXT_LITERAL );
    xAxisPrimary.getMajorGrid( ).
    setTickStyle( TickStyle.BELOW_LITERAL );
    xAxisPrimary.getOrigin( ).
    setType( IntersectionType.VALUE_LITERAL );
    xAxisPrimary.getTitle( ).setVisible( true );

    /* Y-Axis */
    Axis yAxisPrimary = cwaBar.
    getPrimaryOrthogonalAxis( xAxisPrimary );
    yAxisPrimary.getMajorGrid( ).
    setTickStyle( TickStyle.LEFT_LITERAL );
    yAxisPrimary.setType( AxisType.LINEAR_LITERAL );
    yAxisPrimary.getLabel().getCaption( ).
    getFont( ).setRotation( 90 );

    /* Data Set */
    TextDataSet categoryValues =
    TextDataSetImpl.create( new String[]{"Item 1", "Item 2", "Item 3"} );
    NumberDataSet orthoValues = NumberDataSetImpl.
    create( new double[]{25, 35, 15} );

    /* X-Series */
    Series seCategory = SeriesImpl.create( );
    seCategory.setDataSet(categoryValues );
    SeriesDefinition sdX = SeriesDefinitionImpl.create( );
    sdX.getSeriesPalette().update( 0 );
    xAxisPrimary.getSeriesDefinitions( ).add( sdX );
    sdX.getSeries( ).add( seCategory );




    /* Y-Series */
    BarSeries bs = (BarSeries) BarSeriesImpl.create( );
    bs.setDataSet( orthoValues );
    bs.setRiserOutline( null );
    bs.getLabel( ).setVisible( true );
    bs.setLabelPosition( Position.INSIDE_LITERAL );
    SeriesDefinition sdY = SeriesDefinitionImpl.create( );
    yAxisPrimary.getSeriesDefinitions( ).add( sdY );
    sdY.getSeries( ).add( bs );




    ExtendedItemHandle eih = factory.newExtendedItem( null, "Chart" );//$NON-NLS-1$

    eih.setHeight("250pt");
    eih.setWidth("400pt");


    try{
    eih.getReportItem( ).setProperty("chart.instance", cwaBar);
    } catch( ExtendedElementException e)
    {
    e.printStackTrace( );
    }

    design.getBody().add(eih);

    try{
    design.saveAs( "/Users/williamsiakam/Desktop/chart.rptdesign" ); //$NON-NLS-1$
    }
    catch(Exception e){e.printStackTrace();}
    design.close( );


    }

    }


    i would be very thankfull for any help or hint
  • dudluv2001
    dudluv2001 Member
    edited December 31, 1969 #8
    All necessary permissions granted on Unix Box.
    Even tried starting JVM using headless but no use. Thanks in advance for your help!!

    Stack trace is : -

    org.eclipse.birt.chart.reportitem.ChartReportItemImpl serialize Exception
    java.lang.NullPointerException
    at org.eclipse.birt.chart.model.impl.SerializerImpl.asXml(SerializerImpl.java:160)
    at org.eclipse.birt.chart.reportitem.ChartReportItemImpl.serialize(ChartReportItemImpl.java:250)
    at org.eclipse.birt.report.model.extension.PeerExtensibilityProvider.getReportItemExtensionProperty(PeerExtensibilityProvider.java:312)
    at org.eclipse.birt.report.model.extension.PeerExtensibilityProvider.getExtensionProperty(PeerExtensibilityProvider.java:271)
    at org.eclipse.birt.report.model.extension.PeerExtensibilityProvider.copyFromWithNonElementType(PeerExtensibilityProvider.java:720)
    at org.eclipse.birt.report.model.extension.SimplePeerExtensibilityProvider.copyFromWithNonElementType(SimplePeerExtensibilityProvider.java:159)
    at org.eclipse.birt.report.model.elements.ExtendedItem.baseClone(ExtendedItem.java:774)
    at org.eclipse.birt.report.model.core.DesignElement.doClone(DesignElement.java:2916)
    at org.eclipse.birt.report.model.core.StyledElement.doClone(StyledElement.java:74)
    at org.eclipse.birt.report.model.core.ReferencableStyledElement.doClone(ReferencableStyledElement.java:66)
    at org.eclipse.birt.report.model.elements.ExtendedItem.doClone(ExtendedItem.java:754)
    at org.eclipse.birt.report.model.core.MultiElementSlot.doClone(MultiElementSlot.java:53)
    at org.eclipse.birt.report.model.core.ContainerSlot.copy(ContainerSlot.java:203)
    at org.eclipse.birt.report.model.core.DesignElement.doClone(DesignElement.java:2969)
    at org.eclipse.birt.report.model.core.StyledElement.doClone(StyledElement.java:74)
    at org.eclipse.birt.report.model.core.MultiElementSlot.doClone(MultiElementSlot.java:53)
    at org.eclipse.birt.report.model.core.ContainerSlot.copy(ContainerSlot.java:203)
    at org.eclipse.birt.report.model.core.DesignElement.doClone(DesignElement.java:2969)
    at org.eclipse.birt.report.model.core.StyledElement.doClone(StyledElement.java:74)
    at org.eclipse.birt.report.model.core.MultiElementSlot.doClone(MultiElementSlot.java:53)
    at org.eclipse.birt.report.model.core.ContainerSlot.copy(ContainerSlot.java:203)
    at org.eclipse.birt.report.model.core.DesignElement.doClone(DesignElement.java:2969)
    at org.eclipse.birt.report.model.core.StyledElement.doClone(StyledElement.java:74)
    at org.eclipse.birt.report.model.core.ReferencableStyledElement.doClone(ReferencableStyledElement.java:66)
    at org.eclipse.birt.report.model.elements.TableItem.doClone(TableItem.java:318)
    at org.eclipse.birt.report.model.core.MultiElementSlot.doClone(MultiElementSlot.java:53)
    at org.eclipse.birt.report.model.core.ContainerSlot.copy(ContainerSlot.java:203)
    at org.eclipse.birt.report.model.core.DesignElement.doClone(DesignElement.java:2969)
    at org.eclipse.birt.report.model.core.StyledElement.doClone(StyledElement.java:74)
    at org.eclipse.birt.report.model.core.MultiElementSlot.doClone(MultiElementSlot.java:53)
    at org.eclipse.birt.report.model.core.ContainerSlot.copy(ContainerSlot.java:203)
    at org.eclipse.birt.report.model.core.DesignElement.doClone(DesignElement.java:2969)
    at org.eclipse.birt.report.model.core.StyledElement.doClone(StyledElement.java:74)
    at org.eclipse.birt.report.model.core.MultiElementSlot.doClone(MultiElementSlot.java:53)
    at org.eclipse.birt.report.model.core.ContainerSlot.copy(ContainerSlot.java:203)
    at org.eclipse.birt.report.model.core.DesignElement.doClone(DesignElement.java:2969)
    at org.eclipse.birt.report.model.core.StyledElement.doClone(StyledElement.java:74)
    at org.eclipse.birt.report.model.core.ReferencableStyledElement.doClone(ReferencableStyledElement.java:66)
    at org.eclipse.birt.report.model.core.MultiElementSlot.doClone(MultiElementSlot.java:53)
    at org.eclipse.birt.report.model.core.ContainerSlot.copy(ContainerSlot.java:203)
    at org.eclipse.birt.report.model.core.DesignElement.doClone(DesignElement.java:2969)
    at org.eclipse.birt.report.model.core.Module.doClone(Module.java:757)
    at org.eclipse.birt.report.model.api.ModuleHandle.copy(ModuleHandle.java:3265)
    at org.eclipse.birt.report.engine.api.impl.ReportRunnable.cloneRunnable(ReportRunnable.java:202)
    at org.eclipse.birt.report.engine.api.impl.EngineTask.prepareDesign(EngineTask.java:1324)
    at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:89)
    at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:72)
    at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:954)
    at org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(BirtViewerReportService.java:933)
    at org.eclipse.birt.report.service.actionhandler.BirtGetPageAllActionHandler.__execute(BirtGetPageAllActionHandler.java:132)
    at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
    at org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(AbstractBaseDocumentProcessor.java:47)
    at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(AbstractBaseComponentProcessor.java:143)
    at org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleGetPageAll(BirtDocumentProcessor.java:183)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:618)
    at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(AbstractBaseComponentProcessor.java:112)
    at org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(BirtSoapBindingImpl.java:66)
    at sun.reflect.GeneratedMethodAccessor123.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:618)
    at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
    at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
    at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
    at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
    at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
    at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(BirtSoapMessageDispatcherServlet.java:225)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:112)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1097)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1038)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
    at org.eclipse.birt.report.filter.ViewerFilter.doFilter(ViewerFilter.java:68)
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:834)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:682)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:566)
    at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:486)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:748)
    at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
    at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)