Thanks Dave, if this violates the mailing list policy then I'm sorry for that.

But the amazing thing is that I'm not getting any sort of error in log with 
descriptive information. The application is working very fine at our end, also 
for most of the users only few people are getting NullPointer Exceptions.

Whenever they are trying to search a project, the application searches it in 
the database and open the result in a new window. And the error is displaying 
in that window.


Struts-config.xml
=================
Error:
  <global-forwards type="org.apache.struts.action.ActionForward">
 ...
    <forward name="unexpectedError" path="/error/Error.jsp" />
 ...
  </global-forwards>
.
.
.
.
                <action path="/projectSearch"
                                
type="com.myapp.projecttracking.search.ProjectSearch"
                                name="projectSearchForm"
                                input="/main/projectSearch.jsp"
                                validate="true"
                                scope="session">
                        <forward name="success" 
path="/main/projectSearchResults.jsp"/>
                        <forward name="newSearch" 
path="/setupProjectSearch.do"/>
                </action>
====================

ProjectSearch.java
==================
public class ProjectSearch extends Action {


        static Logger log = Logger.getLogger(ProjectSearch.class);

        public ActionForward execute(
                ActionMapping mapping,
                ActionForm form,
                HttpServletRequest request,
                HttpServletResponse response)
                throws IOException, ServletException {
                
                
                
                
                        HttpSession session = request.getSession();
                        GSServices gs = (GSServices) 
(session.getServletContext().getAttribute(Constants.GSServices));
                        
                        Properties props = gs.getAdminSettings();
                        log.debug("Propos: "+props);
                        ProjectSearchForm searchForm = (ProjectSearchForm) 
form;                
                        
                        
                        session.setAttribute(Constants.SEARCHFORM,searchForm);  
                

                        
                        

      String memberID = (String) session.getAttribute("memberID");
/* Temporary Change to run the application --- Tarun Kumar
                        String memberID = 
gs.getGatewaySpecificConfig().getProperty(GSServices.PT_USER_NAME);
                        log.debug("User name="+memberID);                       

                        
                        memberID = 
memberID.substring(memberID.lastIndexOf('\\') + 1);
*/
                        //Catchall if some page wants to redisplay search 
results but form is null
                        if (searchForm == null) {
                                return mapping.findForward("newSearch");
                        }

                        searchForm.setMemberID(memberID);

                        int pageSize = Constants.DEFAULT_PAGE_SIZE;
                        

                        
                        try {                           
                                        int i=searchForm.getResultsPerPage();
                                        if (i >= Constants.MIN_PAGE_SIZE || i 
<= Constants.MAX_PAGE_SIZE) {
                                                pageSize = i;
                                }
                        } catch (NumberFormatException e) {
                                pageSize = Constants.DEFAULT_PAGE_SIZE;
                        }

                        searchForm.setPageSize(pageSize);
                        
                        String pageRequested = 
request.getParameter(Constants.RK_PAGE_NUMBER);
                        if (pageRequested != null) {
                                try {
                                        
searchForm.setPageRequested(Integer.parseInt(pageRequested));
                                } catch(NumberFormatException e) {
                                        //page number specified in the HTTP 
request was not a number, ignore 
                                }
                        } else {
                                searchForm.setPageRequested(1);
                        }
                        
                        String sortByField = 
request.getParameter(Constants.RK_SORT_BY_FIELD);
                        if (sortByField != null) {
                                try {
                                        
searchForm.setSortByField(Integer.parseInt(sortByField));
                                } catch(NumberFormatException e) {
                                        //page number specified in the HTTP 
request was not a number, ignore 
                                }
                        }

                        ActionErrors errors = new ActionErrors();
                        
                        
                        
                        try {

                                SearchCommand search = new SearchCommand();
                
                                //ProjectSearchForm implements ISearchCriteria, 
so we can
                                //safely pass it to the business layer without 
tying the
                                //business layer to Struts or the Servlet API
                                log.debug("Before searching ");
                                
                                

                                log.debug("User's Adgroups are : 
"+(ArrayList)session.getAttribute(Constants.SK_ADGROUPS));
                                ArrayList arradgroups= 
(ArrayList)session.getAttribute(Constants.SK_ADGROUPS);
                                String adgroup;
                                boolean isGPCMember= false;
                                boolean isLPCMember= false;
                                if(arradgroups!=null){
                                        Iterator iter = arradgroups.iterator();
                                        while (iter.hasNext()) {
                                                adgroup= (String) iter.next();
                                                
if(Constants.ROLE_GPC.equals(adgroup)){
                                                        isGPCMember=true;
                                                }
                                                
if(Constants.ROLE_LPC.equals(adgroup)){
                                                        isLPCMember=true;
                                                }
                                        } 
                                }
                                

                                SearchResults results = search.execute(props, 
searchForm, false, isGPCMember, false, isLPCMember);
                                log.debug(".............After 
search.execute...........results.toString()===="+results.toString());
                                
request.setAttribute(Constants.RK_SEARCH_RESULTS, results);

                                
session.setAttribute(Constants.ISEDITABLE,Boolean.FALSE);  
                                
                                return mapping.findForward("success");

                        } catch (NullPointerException e) {

                                log.error(e);

                                //Another action was likely trying to redisplay 
search results, but the
                                //search criteria form is not in a valid state
                                return mapping.findForward("newSearch");

                        } catch (Exception e) {
                                

                try

                {

                  SchedulerVO vo = new SchedulerVO();

                  //Properties props = ((GSServices) 
session.getServletContext().getAttribute(Constants.GSServices)).getAdminSettings();

                  TransactionContext tc = new TransactionContext(props, false); 
               
                  vo.setDetailMessage(e.toString());
                  vo.setSpecificMessage("Error in getting search results");
                  vo.setFormData(searchForm.toString());
                  Util.errorTrack(tc, vo);

                }

                catch (Exception ex)

                {

                  log.error("Exception in inserting Error in DB from 
ProjectSearch.");

                }

                
                                
                                log.error(e.getMessage());
                                errors.add(ActionErrors.GLOBAL_ERROR, new 
ActionError("error.message", e.getMessage()));
                                saveErrors(request, errors);
                                return mapping.findForward("unexpectedError");
                        }
                                        
                }

}
==================

Error.jsp, timeout.jsp, and NotAuthorized.jsp are three error pages in my 
application.

Let me know if I'm wrong at any point.

- Pranab


On Mon, 18 Aug 2008 Dave Newton wrote :
>Attachments aren't propagated to the mailing list. If you really think a 
>screenshot is the best way to capture textual information you could post it to 
>any of several free internet picture sites.
>
>More information would be... helpful. Things like the configuration of the 
>action that's throwing the exception.
>
>Dave
>
>
>--- On Mon, 8/18/08, Pranab <[EMAIL PROTECTED]> wrote:
>
> > From: Pranab <[EMAIL PROTECTED]>
> > Subject: NullPointer Exception On IE7
> > To: user@struts.apache.org
> > Cc: [EMAIL PROTECTED]
> > Date: Monday, August 18, 2008, 5:24 AM
> > Hi Folks,
> >
> > We are facing NullPointer Exceptions in IE7, though such
> > error are not coming in IE6, actually this error is coming
> > at our client on IE7 only. We unable to recreate the same at
> > our side even in IE7.
> >
> > Implementation-Version: 1.0
> > Specification-Title: Struts Framework
> > Specification-Version: 1.0
> > Implementation-Title: Struts Framework
> > Extension-Name: Struts Framework
> > Created-By: Ant 1.4.1
> > Internet Explorer: 7.0
> > JRE: 1.4.x
> > Plumtree Portal: version 4.5 WS1
> > Deployment Server: Weblogic 8.1 SP5
> >
> > Also please find attached is the screen shot of error for
> > your reference. We have implemented the Struts based web
> > application on Plumtree portal.
> >
> > If checking log, only one session is showing for each
> > nullpointer exceptions nothing else.
> >
> > Please let me know if you need anymore details on this.
> >
> > -
> > Pranab---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>

Reply via email to