cancel
Showing results for 
Search instead for 
Did you mean: 

java.lang.nullpointerexception in Groovy script Execution

0 Kudos

Hello Experts .

I am getting java.lang.nullpointerexception in the below Groovy script Execution.

import com.sap.gateway.ip.core.customdev.util.Message

import com.equalize.cpi.converter.FormatConversionBean

def Message processData(Message message)

{ def fcb = new FormatConversionBean(message.exchange, message.getProperties())

def output = fcb.convert() message.setBody(output)

return message }

I have uploaded a Jar file(https://github.com/engswee/equalize-cpi-converter/releases/latest) in the Resources .

It is meant for conversion of file formats. I am looking forward to convert XML to flat file format. I have downloaded the jar file as mentioned in the below link

https://blogs.sap.com/2018/09/04/formatconversionbean-arrives-in-cpi/


I have set the parameters in the content modifier(set-parameters.png).


I have used the below xml as source

<?xml version=”1.0″ encoding=”UTF-8″?>

<ns0:MT_Deep xmlns:ns0=”urn:equalize/DeepFCC”>

<Delivery>

<Type>D</Type>

<DeliveryNo>Delivery2</DeliveryNo>

<Order>

<Type>O</Type>

<DeliveryNo>Delivery2</DeliveryNo>

<OrderNo>Order2_A</OrderNo>

<Item>

<Type>I</Type>

<OrderNo>Order2_A</OrderNo>

<ItemNo>10</ItemNo>

<Quantity>90</Quantity>

</Item>

<Item>

<Type>I</Type>

<OrderNo>Order2_A</OrderNo>

<ItemNo>20</ItemNo>

<Quantity>80</Quantity>

</Item>

</Order>

</Delivery>

</ns0:MT_Deep>


When I deploy and run the iflow I get java.lang.nullpointerexception in Groovy script Execution

Can you please let me know if I have missed out on anything?

Appreciate your support

Regards

Advit

engswee
Active Contributor
0 Kudos

Hi Advit, can you provide a screenshot of the error from Message Monitoring? I'd like to see which line of the script is causing the null pointer error.

0 Kudos

Hello Eng Swee Yeoh,

Thanks for your response . I have attached the log file and the screen hot of the activities that point to the error in the Iflow.

Please let me know if you would like more information.

Appreciate your support.

Regards

Advit

capture.png

messagelog-iflow.txt

0 Kudos

Hello Eng Swee Yeoh,

I was able to get to the bottom of this. I had made a mistake in the file extension of the groovy script, a rookie mistake

I corrected it and deployed it . It seems to be working now. I will run a load of tests on the bean and provide a feed back .

Thanks for your assistance.

Regards

Advit

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

My issue has been solved. I had named the groovy script with extension ".GROOVY" instead of ".groovy". It must be lowercase.

0 Kudos

Hello Advit, @advit_ramesh1

I am getting this same error. Do you mean you didn't name the script with the .groovy extension or was it another issue? I have this same error and unable to solve the problem.

I appreciate any help you can provide.

Thank you,

Rhonda