java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • For input forms, when there are field errors, they appear duplicated. Besides, when there are action/field messages and a 404 page to show, a stacktrace is produced when deployed in Tomcat, not in Jetty. {code} java.lang.NullPointerException at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49) at org.apache.jsp.decorators.default_jsp._jspx_meth_s_005fif_005f0(default_jsp.java:663) at org.apache.jsp.decorators.default_jsp._jspService(default_jsp.java:230) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) ... {code} Final proposed version: {code} <% if (request.getAttribute("struts.valueStack") != null) { %> <%-- ActionError Messages - usually set in Actions --%> <c:if test="${not empty actionErrors}"> <div class="error" id="errorMessages"> <s:iterator value="actionErrors"> <img src="<c:url value="/images/iconWarning.gif"/>" alt="<fmt:message key="icon.warning"/>" class="icon" /> <s:property escape="false"/><br /> </s:iterator> </div> </c:if> <%-- FieldError Messages - usually set by validation rules --%> <c:if test="${not empty fieldErrors}"> <div class="error" id="errorMessages"> <s:iterator value="fieldErrors"> <s:iterator value="value"> <img src="<c:url value="/images/iconWarning.gif"/>" alt="<fmt:message key="icon.warning"/>" class="icon" /> <s:property escape="false"/><br /> </s:iterator> </s:iterator> </div> </c:if> <%-- Success Messages --%> <c:if test="${not empty messages}"> <div class="message" id="successMessages"> <c:forEach var="msg" items="${messages}"> <img src="<c:url value="/images/iconInformation.gif"/>" alt="<fmt:message key="icon.information"/>" class="icon" /> <c:out value="${msg}"/><br /> </c:forEach> </div> <c:remove var="messages" scope="session"/> </c:if> <% } else { %> <%-- avoid duplicate messages: --%> <%-- Error Messages (on JSPs, not through Struts --%> <%-- avoid duplicate messages: --%> <c:if test="${not empty errors}"> <div class="error" id="errorMessages"> <c:forEach var="error" items="${errors}"> <img src="<c:url value="/images/iconWarning.gif"/>" alt="<fmt:message key="icon.warning"/>" class="icon" /> <c:out value="${error}"/><br /> </c:forEach> </div> <c:remove var="errors" scope="session"/> </c:if> <% } %> {code}
    via by J. Garcia,
  • For input forms, when there are field errors, they appear duplicated. Besides, when there are action/field messages and a 404 page to show, a stacktrace is produced when deployed in Tomcat, not in Jetty. {code} java.lang.NullPointerException at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49) at org.apache.jsp.decorators.default_jsp._jspx_meth_s_005fif_005f0(default_jsp.java:663) at org.apache.jsp.decorators.default_jsp._jspService(default_jsp.java:230) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) ... {code} Final proposed version: {code} <% if (request.getAttribute("struts.valueStack") != null) { %> <%-- ActionError Messages - usually set in Actions --%> <c:if test="${not empty actionErrors}"> <div class="error" id="errorMessages"> <s:iterator value="actionErrors"> <img src="<c:url value="/images/iconWarning.gif"/>" alt="<fmt:message key="icon.warning"/>" class="icon" /> <s:property escape="false"/><br /> </s:iterator> </div> </c:if> <%-- FieldError Messages - usually set by validation rules --%> <c:if test="${not empty fieldErrors}"> <div class="error" id="errorMessages"> <s:iterator value="fieldErrors"> <s:iterator value="value"> <img src="<c:url value="/images/iconWarning.gif"/>" alt="<fmt:message key="icon.warning"/>" class="icon" /> <s:property escape="false"/><br /> </s:iterator> </s:iterator> </div> </c:if> <%-- Success Messages --%> <c:if test="${not empty messages}"> <div class="message" id="successMessages"> <c:forEach var="msg" items="${messages}"> <img src="<c:url value="/images/iconInformation.gif"/>" alt="<fmt:message key="icon.information"/>" class="icon" /> <c:out value="${msg}"/><br /> </c:forEach> </div> <c:remove var="messages" scope="session"/> </c:if> <% } else { %> <%-- avoid duplicate messages: --%> <%-- Error Messages (on JSPs, not through Struts --%> <%-- avoid duplicate messages: --%> <c:if test="${not empty errors}"> <div class="error" id="errorMessages"> <c:forEach var="error" items="${errors}"> <img src="<c:url value="/images/iconWarning.gif"/>" alt="<fmt:message key="icon.warning"/>" class="icon" /> <c:out value="${error}"/><br /> </c:forEach> </div> <c:remove var="errors" scope="session"/> </c:if> <% } %> {code}
    via by J. Garcia,
  • Struts2/Tiles internal exception
    via Stack Overflow by Emaborsa
    ,
  • [Struts2] Problema con <s:action> tag
    via by Unknown author,
  • [Struts2] Problem with &lt;s:action&gt; tag
    via by Emanuel Borsoi,
  • web.xml error-page throws exception on s:text
    via by Santosh Sb,
  • Is anything related to time?
    via by liukaipeng,
    • java.lang.NullPointerException at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49) at org.apache.jsp.decorators.default_jsp._jspx_meth_s_005fif_005f0(default_jsp.java:663) at org.apache.jsp.decorators.default_jsp._jspService(default_jsp.java:230) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    No Bugmate found.