cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Null pointer Exception while using DynamicConfiguration

Former Member
0 Likes
5,283

Hi All,

I am working on a proxy to jdbc scenario in which we have to throw validation errors to NWPM(Net Weaver Process Monitor Tool)

I am following the below steps,

step 1 - In message mapping a UDF is created to catch errors and store them in a variable using dynamic configuration

step 2 - writing abap mapping for handling this thrown exception and im reading the dynamic configuration in the abap class and raising exception.

I was using DynamicConfiguration odject as "Conf"

and DynamicConfigurationKey object as "Key".

I wrote below code for Dynamic cofiguration in UDF.

String error="";

error=error+ "missing required field"

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

//DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/Error", "ERROR");

DynamicConfigurationKey keyHeader1 = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/Error", "ERROR");

conf.put(keyHeader1, error);

but while i am trying to test the data in message mapping it will show one error at the time of runtime .

"Runtime exception when processing target-field mapping /ns0:MT_DB2_SourcePlant/Record/SourcePlant; root message: 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 .

I am using addInfo method inAbstractTrace class.Using this i find error at conf.put(keyHeader1, error);

before the conf.put(keyHeader1, error);its working correctly.

Could you please help in finding the solution for getting currect error message from ABAP class?

View Entire Topic
stefan_grube
Active Contributor

> String error="";

> error=error+ "missing required field"

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

add this statement here:

if (conf != null) {

> //DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/Error", "ERROR");

> DynamicConfigurationKey keyHeader1 = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/Error", "ERROR");

>

> conf.put(keyHeader1, error);

}