cancel
Showing results for 
Search instead for 
Did you mean: 

Adapter Module error

Former Member
0 Kudos

Hi All

I coded a adapter module but get the following error:

Message processing failed. Cause: java.lang.NullPointerException: while trying to invoke the method com.sap.engine.interfaces.messaging.api.Message.getMessageDirection() of an object loaded from local variable 'msg'

I use the adapter module in a receiver file adapter after the standard CallSapAdapter, When I take code from sdn from blog for sample adapter module I still get this error.

This is where the code is being used:

Message msg = null;

MessageKey key = null;

try {

obj = inputModuleData.getPrincipalData();

msg = (Message) obj;

if (msg.getMessageDirection().equals(MessageDirection.OUTBOUND))

key = new MessageKey(msg.getMessageId(), MessageDirection.OUTBOUND);

else

key = new MessageKey(msg.getMessageId(), MessageDirection.INBOUND);

Any ideas why I'm getting this error?

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

> I use the adapter module in a receiver file adapter after the standard CallSapAdapter, ...

You cannot put a module after the standard module.

Every module has to be before the standard module.

Former Member
0 Kudos

Hi Stefan

Thx for the reply, I moved it to be the first module and worked but what I want to do is zip the files that gets created. It workes fine if I put my adapter last but as soon as I try to get file name form dynamic config I get this error. Is there a way to do this?

stefan_grube
Active Contributor
0 Kudos

Aftre the standard module the whole XI message is not available anymore. In a sync scenario you could read the response, bit in file adapter there is no response, so the XI message is null, therefore you cannot access the message attributes.

Could you zip the file inside the adapter module (or use payloadzipbean) instead zipping it after being written to file system?

Former Member
0 Kudos

I'm able to zip the files with my adpater module only problem is that my module is after the sapadpter module so the filename is hard coded in the module and this need to be dynamic, have not tried the payloadzipbean.

stefan_grube
Active Contributor
0 Kudos

I mean: zip your payload inside the module, so that the file adapter writes the zipped file.

In this case you can put your module before the standard module.

stefan_grube
Active Contributor
0 Kudos

Here is a coding example for zipping:

/people/alessandro.guarneri/blog/2007/02/21/sap-xi-acting-as-a-huge-file-mover

Answers (1)

Answers (1)

shweta_walaskar2
Contributor
0 Kudos

Hello Stephan,

Can you please check if you are using latest jar file containing MessageKey class?

I remember,I was getting the same error when I was using old jar file (for XI3.0)

Thanks.

Best Regards,

Shweta

Former Member
0 Kudos

Hi Shweta

Where can I find the newest jar files?

Regards,

shweta_walaskar2
Contributor
0 Kudos

Hello Stephan,

Please find the details of changes in jar files for PI7.1 and the location to find these jar files:

http://wiki.sdn.sap.com/wiki/display/XI/XI%20libraries%20for%20development

Thanks.

Best Regards,

Shweta

Former Member
0 Kudos

Hi

I used the new jar files on our PI 7.1 instilation, copied the code from:

http://wiki.sdn.sap.com/wiki/display/XI/AdaptermoduleexampleforPI+7.1

but till get error:

Message processing failed. Cause: java.lang.NullPointerException: while trying to invoke the method com.sap.engine.interfaces.messaging.api.Message.getMessageId() of an object loaded from local variable 'msg'