IBM Support

Null Pointer exception from custom code when Sterling API is called

Troubleshooting


Problem

Null Pointer exception from custom code when Sterling API is called

Symptom

Null Pointer exception from custom code when Sterling API is called

Error Message

java.lang.NullPointerException
        at com.xyz.sterling.userexit.XYZReturnOrderPricingUEImpl.orderReprice(XYZReturnOrderPricingUEImpl.java:85)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.yantra.interop.services.api.ApiHelper.invoke(ApiHelper.java:182)
        at com.yantra.interop.services.flowcomponents.ApiFlowComponent.execute(ApiFlowComponent.java:207)
        at com.yantra.interop.services.flowcomponents.ApiFlowComponent.send(ApiFlowComponent.java:268)
        at com.yantra.integration.adapter.FlowExecutor.execute(FlowExecutor.java:404)
        at com.yantra.integration.adapter.SynchronousIntegrationFlow.executeFlow(SynchronousIntegrationFlow.java:263)
        at com.yantra.interop.services.api.ApiRequestDispatcher.executeFlow(ApiRequestDispatcher.java:88)
        at com.yantra.ycp.core.ue.YCPUEDefaultImpl.invokeFlow(YCPUEDefaultImpl.java:121)
        at com.yantra.omp.api.OMPUserExitProxy.orderReprice(OMPUserExitProxy.java:3024)
        at com.yantra.omp.business.order.manage.YFSManageOrder.callOrderRepricingUE(YFSManageOrder.java:814)
        at com.yantra.omp.business.order.manage.YFSManageOrder.handleChanges(YFSManageOrder.java:1083)
        at com.yantra.omp.business.order.manage.YFSManageOrder.processManageOrder(YFSManageOrder.java:670)
        at com.yantra.omp.business.order.manage.YFSManageOrder.manageOrder(YFSManageOrder.java:515)
        at com.yantra.omp.business.order.manage.YFSManageOrder.createOrder(YFSManageOrder.java:309)
        at com.yantra.omp.business.document.YFSDocumentManagerImpl.create(YFSDocumentManagerImpl.java:67)
        at com.yantra.omp.api.YFSApiImpl.createOrder(YFSApiImpl.java:650)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.yantra.interop.services.api.ApiHelper.invoke(ApiHelper.java:540)
        at com.yantra.integration.adapter.DefaultIntegrationFlow.invoke(DefaultIntegrationFlow.java:191)
        at com.yantra.integration.adapter.DefaultIntegrationFlow.invoke(DefaultIntegrationFlow.java:91)
        at com.yantra.interop.services.api.ApiRequestDispatcher.invoke(ApiRequestDispatcher.java:79)
        at com.yantra.ycp.rcp.backend.YRCBackendUtil.invokeCommand(YRCBackendUtil.java:131)
        at com.yantra.ycp.rcp.backend.YRCServletSCImpl.executeCommand(YRCServletSCImpl.java:269)
        at com.yantra.ycp.rcp.backend.YRCServlet.handleRequest(YRCServlet.java:546)

Resolving The Problem

If an environment variable is created and initialized explicitly in the custom code, care should be taken to make sure that all the necessary attributes in the variable are populated. If not, a NullPointerException might be encountered.

Ideally the environment variable set by the MCF infrastructure should be used.

For the particular issue, using the out of box User Exit with the infrastructure provided environment variable instead of custom API, resolved the issue.

[{"Product":{"code":"SS6PEW","label":"IBM Sterling Order Management"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Extensions","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}},{"Product":{"code":"SS6PEW","label":"IBM Sterling Order Management"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Adapters","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Historical Number

NFX8857

Product Synonym

[<p><b>]Severity[</b><p>];Normal;[<p><b>]Type[</b><p>];NormalFix

Document Information

Modified date:
16 June 2018

UID

swg21557408