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.

[{"Type":"MASTER","Line of Business":{"code":"LOB77","label":"Automation Platform"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SS6PEW","label":"IBM Sterling Order Management System Software"},"ARM Category":[{"code":"a8m0z000000cy00AAA","label":"Orders"},{"code":"a8m0z000000cy02AAA","label":"Payments"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"10.0.0;9.0.0;9.1.0;9.2.0;9.2.1;9.3.0;9.4.0;9.5.0"}]

Historical Number

NFX8857

Product Synonym

IBM Sterling OMS

Document Information

Modified date:
25 June 2025

UID

swg21557408