cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Issue NullPointerException

former_member342243
Participant
0 Kudos

Hello Expert,

Recently we have upgraded our SAP PI 7.1 [QA environment] system service patch level from SP06 to SP15.

After that we are facing issue with some interface which used JAVA UDFs.

While testing message mapping on ESR level we are getting below error message,

Exception:[java.lang.NullPointerException: while trying to invoke the method java.lang.Object.toString() of an object loaded from local variable '<9>'] in class <InterfaceNampspace here>._ServiceTimeCalculation_to_ServiceTimeCalculationReceive_ method retrieveValues[{088=088, 9130=058, 9940=110, 9170=095, -=, 024=, 023=, 005=05, 080=080, 0003=-, 008=, 069=, 9999=80, 9300=088, 030=, 9001=080, 9000=100, 011=, 013=, 110=110, 095=095, 070=070, 9385=111, 093=, 056=, 073=, 058=, 074=, 092=92}, -I29, ZHR_COMPANY_298, com.sap.aii.mappingtool.tf7.rt.Context@15631f39]

In this message mapping, we have used local variable ZHR_COMPANY and we have used UDF here.

Below is my UDF-

public void StoreValues(String[] key, String[] value, String[] mapName, ResultList result, Container container) throws StreamTransformationException{

GlobalContainer gc;

gc = container.getGlobalContainer();

Map map=new HashMap();

for( int i=0; i<key.length;i++)

{

     map.put(key[i],value[i]);

}

String name = mapName[0];

     gc.setParameter(name,map);

//AbstractTrace trace = container.getTrace();

//trace.addInfo("Store");

     result.addValue(map);

}

Same mapping running successfully on Production environment where Service patch is SP06.

Can someone please guide me, where is the problem?

Regards,

Rohan

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member190293
Active Contributor
0 Kudos

Hi Rohan!

Do you have UDF called "retrieveValues" in your mapping?

Regards, Evgeniy.

former_member342243
Participant
0 Kudos

Hello Evgeniy,

Yes, we have that UDF.

-Rohan

former_member190293
Active Contributor
0 Kudos

Hi Rahan!

It just seems like you get error in mentioned UDF and not in those you've posted above.

Regards, Evgeniy.

former_member182412
Active Contributor
0 Kudos

Hi Rohan,

As Evgeniy already pointed If you read the error properly you know in which method getting the exception.

Exception:[java.lang.NullPointerException: while trying to invoke the method java.lang.Object.toString() of an object loaded from local variable '<9>'] in class <InterfaceNampspace here>._ServiceTimeCalculation_to_ServiceTimeCalculationReceive_ method retrieveValues[{088=088, 9130=058, 9940=110, 9170=095, -=, 024=, 023=, 005=05, 080=080, 0003=-, 008=, 069=, 9999=80, 9300=088, 030=, 9001=080, 9000=100, 011=, 013=, 110=110, 095=095, 070=070, 9385=111, 093=, 056=, 073=, 058=, 074=, 092=92}, -I29, ZHR_COMPANY_298, com.sap.aii.mappingtool.tf7.rt.Context@15631f39]


Can you paste the retrieveValues UDF here??


Regards,

Praveen.

former_member342243
Participant
0 Kudos

Hello Praveen,

Here is retrieveValues UDF-

public String retrieveValues(String input, String key, String mapName, Container container) throws StreamTransformationException{

    GlobalContainer gc = container.getGlobalContainer();

    String name = mapName;

    Object hMap = gc.getParameter(name);

    AbstractTrace trace = container.getTrace();

    //trace.addInfo("Retrieve 1 value " +  name+ " Map = " + hMap);

    Object value = null;

    value=((Map)hMap).get(key);

    //trace.addInfo("value" +value);

    return value.toString() ;

}

-Rohan

former_member190293
Active Contributor
0 Kudos

Hi Rohan!

It seems that value=((Map)hMap).get(key); in your code returns null value. You must check if  your UDF input parameters "key" and "mapName" are filled with appropriate values and given map key exists in Map object.

Regards, Evgeniy.

former_member342243
Participant
0 Kudos

Hello Evgeniy,

Parameters 'key' and 'mapName' values are filled correctly. But UDF output is Null.

-Rohan

former_member182412
Active Contributor
0 Kudos

Hi Rohan,

  • The key is -I29 which you are passing in retrieveValues method
  • Prior to this method you are storing this key in the Map object in the method StoreValues, are you passing this key (-I29) to the method StoreValues??
  • Check output of the UDF StoreValues contains this key or not?
  • I think you are not passing -I29 key to StoreValues UDF.


Regards,

Praveen.

former_member186851
Active Contributor
0 Kudos

Also check if you missed any import part?

former_member342243
Participant
0 Kudos

Hello Raghuraman,

Where should I check import ?

-Rohan

manoj_khavatkopp
Active Contributor
0 Kudos

This dosen't seem to be any issue with import check Anupam's reply it has to be issue with your payload for that particular target field.

try with the same payload from RWB in Dev system and see if it results in same error.

former_member186851
Active Contributor
0 Kudos

Hello Rohan,

you can check in the left corner.

anyways as Manoj suggested seems to be becoz of payload.Check with payload first.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Rohan,

                 This UDF uses global container variables. This variables hold values between mappings during run time. Please run the tests end to end instead of ESR level.

I guess there won't be any errors.



Regards

Anupam

former_member342243
Participant
0 Kudos

Hello Anupam,

We have tested this end to end as well, and getting below mapping level error-

com.sap.aii.mappingtool.tf7.MessageMappingException: Runtime exception when processing target-fieldmapping

-Rohan

anupam_ghosh2
Active Contributor
0 Kudos

Hi Rohan,

                This error is different from earlier stated error. This might result from not generating a mandatory field, or  a data expected by any standard function is not being populated.

This is not an error due to version upgrade.

Regards

Anupam