Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

java function with Dynamic config throws null pointer exception

hi Experts,

I am using dynamic config using java function in my message mapping.

The source message has a field called "fname".

The value of "fname" is the input to my java UDF.

The java UDF code is:

public String getDynamicFile(String fname, Container container) throws StreamTransformationException{

String str = fname + ".xml";

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey FileName = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","FileName");

conf.put(FileName, str);

return str;

}

When I test this message mapping I get the following exception:

Runtime Exception:[java.lang.NullPointerException: while trying to invoke the method com.sap.aii.mapping.api.DynamicConfiguration.put(com.sap.aii.mapping.api.DynamicConfigurationKey, java.lang.String) of an object loaded from local variable '<4>'] in class com.sap.xi.tf._<message mapping>_ method getDynamicFile[test, com.sap.aii.mappingtool.tf7.rt.Context@2e52cb31]

What am I doing wrong in this UDF?

Thanks

Gopal

Not what you were looking for? View more on this topic or Ask a question