简体   繁体   English

Spring MVC ApplicationMap上的NullPointerException

[英]NullPointerException on Spring MVC ApplicationMap

Please help to resolve the below issue. 请帮助解决以下问题。

I have done a simple Spring MVC JSP application and intermediately I'm hitting the below null pointer exception , however this exception will be cleared when I reran the application or sometimes it requires my admin service to restart , Please advise. 我已经完成了一个简单的Spring MVC JSP应用程序,在此期间,我遇到了以下空指针异常,但是当我重新运行该应用程序时,有时会清除此异常,或者有时它需要重新启动我的管理服务,请告知。

I'm just trying to submit my login form from jsp and getting this error. 我只是想从jsp提交我的登录表单,并收到此错误。

java.lang.NullPointerException
at com.sun.faces.context.ApplicationMap.get(ApplicationMap.java:97)
at org.springframework.web.jsf.FacesContextUtils.getWebApplicationContext(FacesContextUtils.java:51)
at org.springframework.web.jsf.FacesContextUtils.getRequiredWebApplicationContext(FacesContextUtils.java:81)
at org.springframework.web.jsf.el.SpringBeanFacesELResolver.getWebApplicationContext(SpringBeanFacesELResolver.java:90)
at org.springframework.web.jsf.el.SpringBeanFacesELResolver.getBeanFactory(SpringBeanFacesELResolver.java:78)
at org.springframework.beans.factory.access.el.SpringBeanELResolver.getValue(SpringBeanELResolver.java:50)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at com.sun.faces.el.ChainTypeCompositeELResolver.getValue(ChainTypeCompositeELResolver.java:94)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:188)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:188)
at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:103)
at com.sun.el.parser.AstEmpty.getValue(AstEmpty.java:66)
at com.sun.el.parser.AstNot.getValue(AstNot.java:63)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)
at weblogic.servlet.jsp.ELHelper.evaluate(ELHelper.java:32)
at jsp_servlet._web_45_inf._jsp.__usertodolist._jspService(__usertodolist.java:175)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
..........

UserToDoList_jsp.java public final class UserToDoList_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { UserToDoList_jsp.java公共最终类UserToDoList_jsp扩展了org.apache.jasper.runtime.HttpJspBase实现org.apache.jasper.runtime.JspSourceDependent {

        private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

        private static java.util.List<String> _jspx_dependants;

        private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_c_forEach_var_items;
        private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_form_select_tabindex_path_onchange;
        private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_c_set_value_target_property_nobody;
        private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_form_form_name_modelAttribute_method_action;
        private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_form_option_value_label_nobody;
        private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_c_if_test;
        private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_form_option_value_nobody;

        private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector;

        public java.util.List<String> getDependants() {
          return _jspx_dependants;
        }

        public void _jspInit() {
          _jspx_tagPool_c_forEach_var_items = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
          _jspx_tagPool_form_select_tabindex_path_onchange = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
          _jspx_tagPool_c_set_value_target_property_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
          _jspx_tagPool_form_form_name_modelAttribute_method_action = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
          _jspx_tagPool_form_option_value_label_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
          _jspx_tagPool_c_if_test = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
          _jspx_tagPool_form_option_value_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
        }

        public void _jspDestroy() {
          _jspx_tagPool_c_forEach_var_items.release();
          _jspx_tagPool_form_select_tabindex_path_onchange.release();
          _jspx_tagPool_c_set_value_target_property_nobody.release();
          _jspx_tagPool_form_form_name_modelAttribute_method_action.release();
          _jspx_tagPool_form_option_value_label_nobody.release();
          _jspx_tagPool_c_if_test.release();
          _jspx_tagPool_form_option_value_nobody.release();
        }

        public void _jspService(HttpServletRequest request, HttpServletResponse response)
              throws java.io.IOException, ServletException {

          PageContext pageContext = null;
          HttpSession session = null;
          ServletContext application = null;
          ServletConfig config = null;
          JspWriter out = null;
          Object page = this;
          JspWriter _jspx_out = null;
          PageContext _jspx_page_context = null;

          try {
            response.setContentType("text/html;charset=UTF-8");
            pageContext = _jspxFactory.getPageContext(this, request, response,
                        null, true, 8192, true);
            _jspx_page_context = pageContext;
            application = pageContext.getServletContext();
            config = pageContext.getServletConfig();
            session = pageContext.getSession();
            out = pageContext.getOut();
            _jspx_out = out;
            _jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");

            out.write("\n");
            out.write("\n");
            out.write("\n");
            out.write("\n");
            out.write("\n");
            out.write("\n");
            out.write("\n");
            out.write("\n");
            out.write("\n");
            out.write("<!DOCTYPE html>\n");
            out.write("<html>\n");
            out.write("    <head>\n");
            out.write("        <title>Home</title>\n");
            out.write("    <div class=\"inset\">\n");
            out.write("        ");
            out.print(session.getAttribute("dateTime"));
            out.write("\n");
            out.write("        <h2> TO DO LIST </h2>        \n");
            out.write("        ");
            out.print(session.getAttribute("user"));
            out.write("\n");
            out.write("        <!--  <link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\"/>\n");
            out.write("        -->\n");
            out.write("        <script type=\"text/javascript\">\n");
            out.write("\n");
            out.write("            function changeFunc($i) {\n");
            out.write("                alert($i \"Please select Approve or Reject\");\n");
            out.write("            }\n");
            out.write("        </script>        \n");
            out.write("    </head>    \n");
            out.write("    <body>\n");
            out.write("        <form action=\"logout\" method=\"POST\">\n");
            out.write("            <button type=\"submit\">Logout</button>    \n");
            out.write("        </form>        \n");
            out.write("\n");
            out.write("        <form name=\"Add\" action=\"Adduser\" method=\"post\">\n");
            out.write("            <button type=\"submit\">ADD</button> \n");
            out.write("\n");
            out.write("        </form>\n");
            out.write("        <form name=\"Modify\" action=\"Modifyuser\" method=\"post\">\n");
            out.write("            <button type=\"submit\">Modify</button> \n");
            out.write("\n");
            out.write("        </form>\n");
            out.write("        ");
            //  form:form
            org.springframework.web.servlet.tags.form.FormTag _jspx_th_form_form_0 = (org.springframework.web.servlet.tags.form.FormTag) _jspx_tagPool_form_form_name_modelAttribute_method_action.get(org.springframework.web.servlet.tags.form.FormTag.class);
            _jspx_th_form_form_0.setPageContext(_jspx_page_context);
            _jspx_th_form_form_0.setParent(null);
            _jspx_th_form_form_0.setMethod("POST");
            _jspx_th_form_form_0.setName("TransactionAction");
            _jspx_th_form_form_0.setModelAttribute("action");
            _jspx_th_form_form_0.setAction("transactionAction");
            int[] _jspx_push_body_count_form_form_0 = new int[] { 0 };
            try {
              int _jspx_eval_form_form_0 = _jspx_th_form_form_0.doStartTag();
              if (_jspx_eval_form_form_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
                do {
                  out.write("\n");
                  out.write("            ");
                  //  c:if
                  org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_if_0 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _jspx_tagPool_c_if_test.get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
                  _jspx_th_c_if_0.setPageContext(_jspx_page_context);
                  _jspx_th_c_if_0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_form_0);
                  _jspx_th_c_if_0.setTest(((java.lang.Boolean) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${not empty ToDoList}", java.lang.Boolean.class, (PageContext)_jspx_page_context, null)).booleanValue());
                  int _jspx_eval_c_if_0 = _jspx_th_c_if_0.doStartTag();
                  if (_jspx_eval_c_if_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
                    do {
                      out.write("\n");
                      out.write("\n");
                      out.write("                <table>\n");
                      out.write("\n");
                      out.write("                    <tr> <th>ID</th>\n");
                      out.write("                        <th>LOGIN ID</th>\n");
                      out.write("                        <th>MAKER</th>\n");
                      out.write("                        <th>TRANSACTION TYPE</th>\n");
                      out.write("                        <th>STATUS</th>\n");
                      out.write("                    </tr>    \n");
                      out.write("                    ");
                      //  c:forEach
                      org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_forEach_0 = (org.apache.taglibs.standard.tag.rt.core.ForEachTag) _jspx_tagPool_c_forEach_var_items.get(org.apache.taglibs.standard.tag.rt.core.ForEachTag.class);
                      _jspx_th_c_forEach_0.setPageContext(_jspx_page_context);
                      _jspx_th_c_forEach_0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_if_0);
                      _jspx_th_c_forEach_0.setVar("item");
                      _jspx_th_c_forEach_0.setItems((java.lang.Object) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${ToDoList}", java.lang.Object.class, (PageContext)_jspx_page_context, null));
                      int[] _jspx_push_body_count_c_forEach_0 = new int[] { 0 };
                      try {
                        int _jspx_eval_c_forEach_0 = _jspx_th_c_forEach_0.doStartTag();
                        if (_jspx_eval_c_forEach_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
                          do {
                            out.write("\n");
                            out.write("                        <tr>\n");
                            out.write("                            <td> <input value=\"");
                            out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${item[0]}", java.lang.String.class, (PageContext)_jspx_page_context, null));
                            out.write("\" type=\"number\" name=\"id\" readonly /></td>\n");
                            out.write("                            <td> <input value=\"");
                            out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${item[1]}", java.lang.String.class, (PageContext)_jspx_page_context, null));
                            out.write("\" type=\"text\" name=\"loginId\" readonly /></td>\n");
                            out.write("                            <td> <input value=\"");
                            out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${item[2]}", java.lang.String.class, (PageContext)_jspx_page_context, null));
                            out.write("\" type=\"text\" name=\"maker\" readonly /></td>\n");
                            out.write("                            <td> <input value=\"");
                            out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${item[3]}", java.lang.String.class, (PageContext)_jspx_page_context, null));
                            out.write("\" type=\"text\" name=\"transactionType\" readonly /></td>\n");
                            out.write("                            <td> <input value=\"");
                            out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${item[4]}", java.lang.String.class, (PageContext)_jspx_page_context, null));
                            out.write("\" type=\"text\" name=\"status\" readonly /></td>\n");
                            out.write("                            <td>\n");
                            out.write("                                ");
                            //  form:select
...
}

This exception above occurs in usertodolist.jsp . 上面的异常发生在usertodolist.jsp The NPE is caused because of a null-key, so that means something in the EL evaluates to null . NPE是由空键引起的,因此这意味着EL中的某些内容的值为null

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM