cancel
Showing results for 
Search instead for 
Did you mean: 

Error in adapter module Upgrade PI7.11

shweta_walaskar2
Contributor
0 Kudos

Hello,

After upgrade from XI3.0 to PI7.11,I am trying to adapt code of an adapter module in order to use it in new version.

I have changed the code ,there were no compilation errors and it was deployed successfully.

But when trying to test the scenario ,I am getting following error:

<code>ADAPTER.JAVA_EXCEPTION</code>

<text>javax.ejb.EJBException: (Failed in component: sap.com/ValidationModule7.11_EAR) Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.sapcons.xi.af.validation.ValidationModuleBean711.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.sapcons.xi.af.validation.ValidationModuleBean711@4dee79d1 for bean sap.com/ValidationModule7.11_EARxml|ValidationModule7.11_EJB.jarxml|ValidationModuleBean711 in application sap.com/ValidationModule7.11_EAR.; nested exception is: java.lang.NullPointerException: while trying to invoke the method com.sap.engine.interfaces.messaging.api.MessageKey.getMessageId() of an object loaded from local variable 'msgKey'

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

I am nowhere using variable 'msgkey' in my code.

I was using getMessageId() method and because of this error,I have changed the code such that I am not using this method at all.

After this change ,I have deployed the module again,and the strange part is I am still getting the same error.

Just to be sure that I have deployed the changed code,I created an altogether new module ValidationModule7.11_EAR(it was ValidationModule_EAR before) and deployed it,I am sure ,I am not using getMessageId() method at all,but I am getting the same error (as mentioned above).

I have no idea why I am getting the same error.I can see in the error message that my new module is called which doesn't use this method.

Can anyone please suggest apart from saving the Bean after code changes and redeploying the code,what needs to be done.

(Rebuilding the project,etc.)

It would be great if I can get some inputs on this strange behaviour.

Thanks a lot.

Best Regards,

Shweta

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
former_member207622
Contributor
0 Kudos

Hi Shweta ,

Have you checked your bean stateless or stateful , as per documentation it should be stateless

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/8085e299-718c-2a10-de94-928f62b76...

Check this note Note 1062037 java.lang.NullPointerException error in Adapter activation

Have you used new libraries in PI 7.11

You can also add audit logs Note 1004000.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0667f56-96c7-2b10-0e9a-c40fbd523...

Hope this helps

regards

Ninad

shweta_walaskar2
Contributor
0 Kudos

Hi Kiran,

Thanks a lot for providing the links to the documentation.

However,I am still not sure as I am not using this method.

Regards,

Shweta

shweta_walaskar2
Contributor
0 Kudos

Hi Ninad,

Thanks a lot for your inputs.Regarding your checkpoints:

Have you checked your bean stateless or stateful , as per documentation it should be stateless : Stateless

Have you used new libraries in PI 7.11 : Yes

You can also add audit logs Note 1004000. : I have added audit logs in the code,but this adapter module fails even before it reaches XI,so I cannot see any log or trace in XI.The error mentioned is what I get in SOAPUI when I try to send a request to XI.

I am not able to find out at which point this nummpointer exception is raised as I cannot see any message in XI

Thanks again.

Best Regards,

Shweta

Answers (1)

Answers (1)

stefan_grube
Active Contributor
0 Kudos

Did you your different with same JNDI name?

In my experience, the reuse of same JNDI name leads to an unstable state in the Java engine, that means you cannot be sure which code is actually processe.

The error could occur because there is not a link to the interface com.sap.aii.af.ifc.facade in application-j2ee-engine.xml

Check if this value exists and is defined as interface.

See also this:

/people/stefan.grube/blog/2008/12/11/adjust-your-pi-70-adapter-modules-for-pi-71-in-15-minutes

shweta_walaskar2
Contributor
0 Kudos

Hello Stefan,

Thanks for your reply.

I have created my new module with a different JNDI name.

Also,I have verified that there is a link to the interface com.sap.aii.af.ifc.facade in application-j2ee-engine.xml .

This was the code which I was trying to adapt:

if((MessageContext)inputModuleData.getPrincipalData() instanceof MessageContext)

{

MessageContext messsageContext = (MessageContext)inputModuleData.getPrincipalData();

Message message = messsageContext.getMessage();

Attachment rootDocument = message.getRootDocument();

Object data = rootDocument.getData();

if(data instanceof Binary)

{

Binary bin = (Binary)data;

request = bin.getBytes();

String messageID = "1232";

if(dir == Direction.INBOUND)

amk = new AuditMessageKey(messageID, AuditDirection.INBOUND);

else

amk = new AuditMessageKey(messageID, AuditDirection.OUTBOUND);

But I was getting errors like MessageContext not recognized and also,for the statement:

Attachment rootDocument = message.getRootDocument();

I was getting an error in statement : if(data instanceof Binary) as following imports weren't recognized.

import com.sap.aii.messaging.lang.Binary;

import com.sap.aii.messaging.mo.*;

So I used import com.sap.aii.af.service.cpa.BinaryData; and following code

Object obj = null;

Message message = null;

obj = inputModuleData.getPrincipalData();

if(obj instanceof BinaryData)

{

message = (Message)obj;

BinaryData bin = (BinaryData)obj;

request = bin.getData();

String messageID = "1232";

amk = new MessageKey(messageID, message.getMessageDirection());

});

Code was compiled correctly and deployed ,but I get this error with getMessageId() when I try to test it.You can see I am not using getMessageId() and msgkey anywhere in the code

Thanks for your help

Regards,

Shweta

stefan_grube
Active Contributor
0 Kudos

See the link for an example code for PI 7.1

This code was tested by me and worked without issues.

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

shweta_walaskar2
Contributor
0 Kudos

Hello Stefan,

I have modified the code as per the example you have shown.

But I really feel that this is some other issue,no matter what changes I make in the code,I always get the same error which I have mentioned.

How is that possible?

Regards,

Shweta

stefan_grube
Active Contributor
0 Kudos

I think your original wrong EJB is called even after you changed your code.

Make sure that in your communication channel, you have assigned the correct JNDI name for the latest version of your module.

activate the channel again and check the cache. Maybe you have to perform a cache refresh.

Try also to undeploy all EAR files that are related to this issue.

shweta_walaskar2
Contributor
0 Kudos

Hi Stefan,

I have verified ,JNDI name is correct in CC,because if I change the name in CC ,I get objectnotfound error.

Also,we tried undeploying all previously deployed modules ,redeployed the new code again,performed cache refresh and I still get exactly same error

Any other hint?

Thanks a lot.

Best Regards,

Shweta

stefan_grube
Active Contributor
0 Kudos

I think following is not possible:

String messageID = "1232";

..

amk = new AuditMessageKey(messageID, AuditDirection.INBOUND);

messageID must be a real message ID.

Edited by: Stefan Grube on Dec 7, 2010 1:50 PM

Edited by: Stefan Grube on Dec 7, 2010 1:50 PM

stefan_grube
Active Contributor
0 Kudos

use this instead:

obj = inputModuleData.getPrincipalData();
      msg = (Message) obj;
      amk = new MessageKey(msg.getMessageId(),msg.getMessageDirection());

shweta_walaskar2
Contributor
0 Kudos

Hello Stefan,

Thanks,I have updated the code still ,I get the same error.

I have noticed one thing,I am changing the code,saving the files and selecting update EAR libraries.

I even tried deleting EAR and deploying it again when EAR is created afresh.

But when I extracted java file from EAR,I see old code,it is not updated in EAR.

What else I need to do so that code is updated in EAR?

Thanks for your help.

Regards,

Shweta

stefan_grube
Active Contributor
0 Kudos

This is strange.

Check the source path for creating the EAR files.

shweta_walaskar2
Contributor
0 Kudos

Hello Stefan,

This module is used for XSD schema validation for incoming SOAP request.

I still get lot of errors with this module.

I have just read somewhere that an option for XSD schema validation for incoming SOAP request is already available in PI7.11

Does this mean,we don't need to use this adapter module in PI7.11?

Kindly let me know.

Thanks.

Regards,

Shweta

stefan_grube
Active Contributor
0 Kudos

That depends what your module does.

The PI 7.1 schema validation rejects the incoming call with a simple error message.

shweta_walaskar2
Contributor
0 Kudos

Hi Stefan,

As far as I understood,this module validates SOAP request again corresponding XSDs.

I have gone through the How to guide for XML schema validation in PI7.11, and it also does the same.

Thanks.

Regards,

Shweta

stefan_grube
Active Contributor
0 Kudos

So the module is used in SOAP sender adapter?

That is the reason why it cannot be transferred to PI 7.1

I should have know, as the line

MessageContext messsageContext = (MessageContext)inputModuleData.getPrincipalData();

There is no upgrade guide for modules used in SOAP sender adapter.

Only specialists know how to create adapter modules for this.

stefan_grube
Active Contributor
0 Kudos

For example "The Guarneri"

/people/alessandro.guarneri/blog/2010/08/03/soap-sender-adapter-modules

shweta_walaskar2
Contributor
0 Kudos

Hello Stefan,

Sorry for my late reply.We could solve the problem using standard XML schema validation feature provided by PI7.1

Thanks a lot for your help and guidance.

Best Regards,

Shweta