Question & Answer
Question
Receiving null pointer exception when trying to send out a message *|* -C78375122D10AFA28525723A006C99BC- *|*
Answer
Technote (troubleshooting)
Problem(Abstract)
When trying to send out a message a CommandException occurs.
Symptom
The following error occurs in the log:
[10/16/06 10:29:29:950 EDT] 1c9c5da ComponentMeta E WSVR0603E:
ComponentMetaDataAccessor beginContext method received a NULL
ComponentMetaData.
[10/16/06 10:29:30:027 EDT] 1c9c5da CommerceSrvr E
com.ibm.commerce.command.ECCommandTarget executeCommand CMN0420E: The
following CommandException occurred during processing:
"java.lang.NullPointerException".java.lang.NullPointerException at com.ibm.ejs.persistence.RemoteEnumeratorImpl.nextNElements(RemoteEnumera
torImpl.java:91) at com.ibm.ejs.persistence.PortableFinderEnumerator.fetchElements(PortableF
inderEnumerator.java:375) at com.ibm.ejs.persistence.PortableFinderEnumerator.hasMoreElementsR(Portab
leFinderEnumerator.java:179) at com.ibm.ejs.persistence.PortableFinderEnumerator.hasMoreElements(Portabl
eFinderEnumerator.java:140) at com.ibm.ejs.persistence.PortableFinderEnumeration.hasMoreElements(Portab
leFinderEnumeration.java:80) at
com.ibm.ivj.ejb.runtime.AccessBeanEnumeration.hasMoreElements(AccessBean
Enumeration.java:56) at
com.ibm.commerce.messaging.util.RunTimeProfile.getCSForProfile(RunTimePr
ofile.java:79) at
com.ibm.commerce.messaging.outboundservice.Messaging.loadAdminData(Messa
ging.java:3140) at
com.ibm.commerce.messaging.outboundservice.Messaging._init(Messaging.jav
a:395) at
com.ibm.commerce.messaging.outboundservice.Messaging.<init>(Messaging.ja
va:245) at
com.ibm.commerce.messaging.outboundservice.Messaging.<init>(Messaging.ja
va:186) at
com.ibm.commerce.messaging.commands.SendMsgCmdImpl.performExecute(SendMs
gCmdImpl.java:313) at
com.ibm.commerce.command.ECCommandTarget.executeCommand(ECCommandTarget. java:133) at com.ibm.ws.cache.command.CommandCache.executeCommand(CommandCache.java:3 33)
Cause
When sending out a message using WebSphere Commerce SendMsgCmd API the getCSForProfile method is getting called to read the configuration data from the CSEDITATT table. For this operation to be performed it should be enclosed in an active transaction. If there is no transaction open at this moment the null pointer exception is generated.
To verify whether there is an active transaction enable WC_SERVER tracing and check for TransactionManager for the current thread just before the error. If you see the last output from the TransactionManager before the error shows committing transaction then there is no active transaction when the getCSForProfile method gets called.
Resolving the problem
SendMsgCmd is a task command so it does not provide transaction management. In all of the default WebSphere Commerce code SendMsgCmd gets called only from a controller command. When calling this command from your customized code ensure that the call is encompassed in a transaction.
To check if the transaction exists during the call to SendMsgCmd enable tracing for WC_SERVER and look for messages coming from TransactionManager before the call to SendMsgCmd.
The following message indicates a new transaction:
WC_SERVER > TransactionManager.begin Entry
If the following message appears as the latest message from the Transaction Manager just before the SendMsgCmd then transaction does not exist during the call and the exception might be thrown:
WC_SERVER < TransactionManager.commit Exit
| Segment | Product | Component | Platform | Version | Edition |
|---|---|---|---|---|---|
| Commerce | WebSphere Commerce Professional Edition | Customization / Application Development | 5.6 5.6.1 6.0 | ||
| Commerce | WebSphere Commerce Business Edition | Customization / Application Development | 5.6 5.6.1 | ||
| Commerce | WebSphere Commerce - Express | 5.6 5.6.1 6.0 |
Was this topic helpful?
Document Information
Modified date:
12 October 2021
UID
ibm10769025