Nano Hash - криптовалюты, майнинг, программирование

NullPointerException в Spring MVC ApplicationMap

Пожалуйста, помогите решить следующую проблему.

Я сделал простое приложение Spring MVC JSP, и в промежутке я сталкиваюсь с приведенным ниже исключением нулевого указателя, однако это исключение будет очищено, когда я повторно запущу приложение или иногда требуется перезапустить мою службу администратора. Пожалуйста, сообщите.

Я просто пытаюсь отправить форму входа из 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 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
...
}

  • Вы действительно не должны сравнивать такие строки. Вы должны попробовать вместо этого "success".equals(result). 27.09.2014
  • @Makoto спасибо за ваш совет, я изменился соответственно. Пожалуйста, сообщите о прерывистом NPE. 28.09.2014

Ответы:


1

Это исключение выше происходит в usertodolist.jsp. NPE вызывается из-за нулевого ключа, поэтому это означает, что что-то в EL оценивается как null.

27.09.2014
  • Если он равен нулю, то ошибка должна быть последовательной, но в моем случае она прерывистая. 27.09.2014
  • Не обязательно. Что-то может измениться в env. Можете ли вы заглянуть в usertodolist и опубликовать код EL или даже получить __usertodolist.java и посмотреть на строку 175? 30.09.2014
  • Добавлен UserToDoList_jsp.java, пожалуйста, помогите 04.10.2014
  • Есть несколько вызовов для оценкиExpression(${item[0]}), но нет вызовов для оценки. Я не уверен, является ли причиной опубликованный файл. Упомянутый класс в трассировке стека — __usertodolist, вы разместили UserToDoList_jsp 05.10.2014
  • Новые материалы

    Кластеризация: более глубокий взгляд
    Кластеризация — это метод обучения без учителя, в котором мы пытаемся найти группы в наборе данных на основе некоторых известных или неизвестных свойств, которые могут существовать. Независимо от..

    Как написать эффективное резюме
    Предложения по дизайну и макету, чтобы представить себя профессионально Вам не позвонили на собеседование после того, как вы несколько раз подали заявку на работу своей мечты? У вас может..

    Частный метод Python: улучшение инкапсуляции и безопасности
    Введение Python — универсальный и мощный язык программирования, известный своей простотой и удобством использования. Одной из ключевых особенностей, отличающих Python от других языков, является..

    Как я автоматизирую тестирование с помощью Jest
    Шутка для победы, когда дело касается автоматизации тестирования Одной очень важной частью разработки программного обеспечения является автоматизация тестирования, поскольку она создает..

    Работа с векторными символическими архитектурами, часть 4 (искусственный интеллект)
    Hyperseed: неконтролируемое обучение с векторными символическими архитектурами (arXiv) Автор: Евгений Осипов , Сачин Кахавала , Диланта Хапутантри , Тимал Кемпития , Дасвин Де Сильва ,..

    Понимание расстояния Вассерштейна: мощная метрика в машинном обучении
    В обширной области машинного обучения часто возникает необходимость сравнивать и измерять различия между распределениями вероятностей. Традиционные метрики расстояния, такие как евклидово..

    Обеспечение масштабируемости LLM: облачный анализ с помощью AWS Fargate и Copilot
    В динамичной области искусственного интеллекта все большее распространение получают модели больших языков (LLM). Они жизненно важны для различных приложений, таких как интеллектуальные..