Hello All
I have developed the module to achieve Dynamic EOIO Queue.
I have deployed the module.
I am getting error = "An error occurred while processing message: 8b644171-fa18-4e01-1775-a4069728c0c3. The detailed error (if any): com.sap.aii.adapter.jms.api.channel.filter.MessageFilterException: while trying to invoke the method org.w3c.dom.Element.getChildNodes() of a null object loaded from local variable Elmnt1: NullPointerException: while trying to invoke the method org.w3c.dom.Element.getChildNodes() of a null object loaded from local variable 'Elmnt1' at com.sap.aii.adapter.jms.core.channel.filter.SendToModuleProcessorFilter.filter(SendToModuleProcessorFilter.java:95) ..."
Code
com.sap.adaptermodule;
java.rmi.RemoteException;
javax.ejb.EJBException;
javax.ejb.SessionBean;
javax.ejb.SessionContext;
javax.ejb.TimedObject;
javax.ejb.Timer;
org.w3c.dom.Document;
org.w3c.dom.Node;
org.w3c.dom.NodeList;
org.w3c.dom.Element;
java.io.InputStream;
javax.xml.parsers.DocumentBuilder;
javax.xml.parsers.DocumentBuilderFactory;
com.sap.aii.af.lib.mp.module.*;
com.sap.engine.interfaces.messaging.api.*;
public class DynamicEOIOBean implements SessionBean, TimedObject
{
static final String c_param1 = "queuePrefix";
static final String c_param2 = "Xmlnode";
private static final long serialVersionUID=100L;
/* (non-Javadoc)
* @see javax.ejb.SessionBean#ejbActivate()
*/
public void ejbActivate() throws EJBException, RemoteException
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.SessionBean#ejbPassivate()
*/
public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.SessionBean#ejbRemove()
*/
public void ejbRemove() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
*/
public void setSessionContext(SessionContext arg0) throws EJBException,
RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.TimedObject#ejbTimeout(javax.ejb.Timer)
*/
public void ejbTimeout(Timer arg0) {
// TODO Auto-generated method stub
}
public void ejbCreate() throws javax.ejb.CreateException
{
}
public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData)throws
ModuleException
{
try
{
String param1 = moduleContext.getContextData(c_param1);
String param2 = moduleContext.getContextData(c_param2);
Message msg = (Message) inputModuleData.getPrincipalData();
Payload payload = msg.getDocument();
InputStream inps = (InputStream) payload.getInputStream();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(inps);
doc.getDocumentElement().normalize();
NodeList nodeLst1 = doc.getElementsByTagName(param1);
NodeList nodeLst2 = doc.getElementsByTagName(param2);
Element Elmnt1 = (Element) nodeLst1.item(0);
Element Elmnt2 = (Element) nodeLst2.item(0);
NodeList ndLst1 = Elmnt1.getChildNodes();
NodeList ndLst2 = Elmnt2.getChildNodes();
String queueId;
if (ndLst1.item(0) != null)
queueId = ndLst1.item(0).getNodeValue().concat(ndLst2.item(0).getNodeValue());
else
queueId = msg.getSequenceId();
msg.setSequenceId(queueId);
inputModuleData.setPrincipalData(msg);
return inputModuleData;
} catch (Exception e) {
e.printStackTrace();
ModuleException me = new ModuleException("Unable to create Queue", e);
throw me;
}
}
}
Please help to resolve what need to change in code.
Thanks
Dheeraj Kumar