Hi,

We are using xalan for xpath search. 
The following error occurs when the code uses XPath to find the actionclass for 
a given 
page id and even id
        //FRACAS/PAGEID[VALUE='1']/EVENTID[VALUE='1']/ACTIONCLASS

This error occurs occasionally(randomly).


2003-12-05 16:18:30,723 [ExecuteThread: '1' for queue: 'default'] DEBUG 
com.gepower.ps.eps - Inside getActionBean in ActionFactory.
2003-12-05 16:18:30,724 [ExecuteThread: '1' for queue: 'default'] DEBUG 
com.gepower.ps.eps - Inside getActionConfig in ActionConfig. Retrieving Action 
config for module : FRACAS
2003-12-05 16:18:30,724 [ExecuteThread: '1' for queue: 'default'] DEBUG 
com.gepower.ps.eps - Using Xpath ===> 
//FRACAS/PAGEID[VALUE='1']/EVENTID[VALUE='1']/ACTIONCLASS
2003-12-05 16:18:30,727 [ExecuteThread: '1' for queue: 'default'] WARN  
com.gepower.ps.eps -  Severity=3 ErrorCode=EPS0000 Message=Configuration 
error..  java.lang.NullPointerException
        at org.apache.xpath.DOMHelper.getLocalNameOfNode(DOMHelper.java:818)
        at org.apache.xpath.DOM2Helper.getLocalNameOfNode(DOM2Helper.java:328)
        at org.apache.xpath.patterns.NodeTest.execute(NodeTest.java:488)
        at 
org.apache.xpath.axes.PredicatedNodeTest.acceptNode(PredicatedNodeTest.java:388)
        at org.apache.xpath.axes.AxesWalker.nextNode(AxesWalker.java:1165)
        at 
org.apache.xpath.axes.LocPathIterator.nextNode(LocPathIterator.java:689)
        at org.apache.xpath.XPathAPI.selectSingleNode(XPathAPI.java:123)
        at org.apache.xpath.XPathAPI.selectSingleNode(XPathAPI.java:100)
        at com.gepower.ps.eps.framework.ActionFactory.getActionBean(Unknown 
Source)
        at com.gepower.ps.eps.framework.GenericModule.getActionBean(Unknown 
Source)
        at com.gepower.ps.eps.framework.GenericModule.doProcess(Unknown Source)
        at 
com.gepower.ps.eps.fracas.FracasRequestCmd.perform(FracasRequestCmd.java:57)
        at 
com.ge.dialect.cb.DefaultController.processInteraction(DefaultController.java:776)
        at 


The xml document being searched for is given below
--------------------------------------------------


<?xml version="1.0"?>
<FRACAS>
        <PAGEID>
                <VALUE>1</VALUE>
                <EVENTID>
                        <VALUE>1</VALUE>
                        
<ACTIONCLASS>com.gepower.ps.eps.fracas.FracasAct</ACTIONCLASS>
                        <XSLNAME>FracasHome.xsl</XSLNAME>
                </EVENTID>
        </PAGEID>
        <PAGEID>
                <VALUE>2</VALUE>
                <EVENTID>
                        <VALUE>1</VALUE>
                        
<ACTIONCLASS>com.gepower.ps.eps.fracas.FracasAct</ACTIONCLASS>
                        <XSLNAME>FracasCollect.xsl</XSLNAME>
                </EVENTID>
        </PAGEID>
        <PAGEID>
                <VALUE>3</VALUE>
                <EVENTID>
                        <VALUE>1</VALUE>
                        
<ACTIONCLASS>com.gepower.ps.eps.fracas.FracasAct</ACTIONCLASS>
                        <XSLNAME>FracasDownLoad.xsl</XSLNAME>
                </EVENTID>
        </PAGEID>

</FRACAS>



The code fragment where the exception occurs is given below
-----------------------------------------------------------

        ActionConfig.getActionConfig(inputBean.get_moduleName()) returns the 
cached     
        Document object. 
                
        The application is a web based application running on weblogic6.1.
        
        
        XPathAPI.selectSingleNode(doc, xpathStrClassName); //****Error occurs 
here****/
        
        
------------------------------------------------------------------------------


        public static AbsAction getActionBean(GenericInputBean inputBean)
                throws EPSException {
                EPSLogger.debug("Inside getActionBean in ActionFactory.");
                
                Document doc = 
ActionConfig.getActionConfig(inputBean.get_moduleName());

                if (doc != null) {
                        String sModuleName = inputBean.get_moduleName();
                        int iPageId = inputBean.get_pageId();
                        int iEventId = inputBean.get_eventId();

                        // parse the xml file for the iPageId, evenid and get 
the
                        //<CLASSNAME> node data from the document
                        //Using XPath
                        StringBuffer sbXpathClassName = new 
StringBuffer(Constants.SBSIZE);
                        sbXpathClassName.append("//");
                        sbXpathClassName.append(sModuleName.toUpperCase());
                        sbXpathClassName.append("/PAGEID[VALUE='" + iPageId + 
"']");
                        sbXpathClassName.append(
                                "/EVENTID[VALUE='" + iEventId + 
"']/ACTIONCLASS");
                        String xpathStrClassName = sbXpathClassName.toString();
                        EPSLogger.debug("Using Xpath ===> " + 
xpathStrClassName);
                        try {
                                // Get the matching elements
                                Node classNameNode =
                                        XPathAPI.selectSingleNode(doc, 
xpathStrClassName); //****Error occurs here****/ 

                                String className = 
classNameNode.getFirstChild().getNodeValue();
                                /*              if (className == null) {
                                                 throw new Exception("Classname 
not found.");
                                                }*/
                                EPSLogger.debug(
                                        "In ActionFactory loading class ===> " 
+ className);
                                Class cdaClass = Class.forName(className);

We need a solution very urgently.

Thanks in advance.
prabhakar a j

Reply via email to