|
Does anyone have experience with the following type of bug? It may not
precisely be an iBATIS problem, but it occurred in a code pattern I
borrowed from JPetstore, which has the same problem in its
SearchProducts page. A null pointer exception occurs in the doStartTag
function of the Struts IterateTag when the user clicks the Next or Prev
button (actually an image) after the user has been idle for some
longish period of time (say 30 minutes?). At this point, the
IterateTag's doStartTag function is about to do something with a
PaginatedArrayList instance. However, I'm guessing it may be a page
context variable that has gone null, rather than some problem with the
PaginatedArrayList instance. Previously, I had thought that it was the session expiring that was causing the problem, but several attempts to trap a null session using request.getSession(false), including writing an ExpiredSessionFilter to catch that situation and redirect to a warning page have failed to ever detect a null return value from request.getSession(false). Also, even earlier, I had thought it was the PaginatedArrayList that had the problem and included some code to test for empty and for null use, such as in the following excerpt: <bean:define id="category" name="catalogBean" property="category" /> <bean:define id="productList" name="catalogBean" property="productList" /> ... <logic:notEmpty name="productList"> <logic:present name="productList"> ... <logic:iterate id="product" name="productList" > ... <bean:write name="product" property="productName" /> ... <bean:write filter="false" name="product" property="productDescr"/> ... </logic:iterate> ... </logic:present> </logic:notEmpty> However, the above code did not help prevent the NullPointerException. Any suggestions? The struts-config.xml action is similar to that of JPetstore: <action path="/cat/scrollProdListForCat" type="com.ibatis.struts.BeanAction" name="catalogBean" scope="session" validate="false" > <forward name="success" path="/WEB-INF/pages/catalog/ProdListForCategory.jsp" /> </action> Likewise, the action code is similar to JPetstore: public Object scrollProdListForCat() { if ("next".equals(pageDirection) && productList != null) { productList.nextPage(); } else if ("previous".equals(pageDirection) && productList != null) { productList.previousPage(); } return "success"; } My development environment is Win XP, Eclipse 3.0.1, Sun JDK 1.5.0_01, Struts 1.1., iBATIS SqlMaps 2.0.8, iBATIS DAO 2.0.8, JBoss 4.0. The JPetstore version is 4.0.5. I observed the same problem running the same environment on Linux rather than XP, so the problem almost certainly has nothing to do with the OS. type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069) org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) javax.servlet.http.HttpServlet.service(HttpServlet.java:697) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) net.sf.wfnm.web.NoMultipleSubmitFilter.doFilter(NoMultipleSubmitFilter.java:73) net.sf.wfnm.web.SessionBindingFilter.doFilter(SessionBindingFilter.java:49) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75) root cause java.lang.NullPointerException org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:362) org.apache.jsp.WEB_002dINF.pages.catalog.ProdListForCategory_jsp._jspService(ProdListForCategory_jsp.java:184) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069) org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) javax.servlet.http.HttpServlet.service(HttpServlet.java:697) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) net.sf.wfnm.web.NoMultipleSubmitFilter.doFilter(NoMultipleSubmitFilter.java:73) net.sf.wfnm.web.SessionBindingFilter.doFilter(SessionBindingFilter.java:49) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75) |
- xml parsing issue using jdk 1.3 - iBatis fix version 2.1.0 new_user
- Re: xml parsing issue using jdk 1.3 - iBatis fix vers... Clinton Begin
- Craig Johannsen

