耐心無止境 成功一瞬間

          BlogJava 聯系 聚合 管理
            31 Posts :: 5 Stories :: 25 Comments :: 0 Trackbacks

          當把struts2下所有的包放在lib下,啟動時的確會報錯(啥錯給忘了),最好是用到什么包自己加什么包,我最常用ssh所以~~~,一下錯誤經驗分享一下。
          1。沒有加入spring包以前,只加入了struts2-spring-plugin-2.0.6.jar
            2007-3-21 17:37:29 org.apache.catalina.core.StandardContext filterStart
             嚴重: Exception starting filter struts2
             Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory
          2。加入了spring包以后的工程
              java.lang.NullPointerException
             at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance  (SpringObjectFactory.java:188)at    com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType   (XmlConfigurationProvider.java:479)
          3。/在web.xml文件中加入,問題解決
          <context-param>
              <param-name>contextConfigLocation</param-name>
              <param-value>/WEB-INF/applicationContext.xml</param-value>
          </context-param>
          //listenre會自動在web-inf文件夾下尋找applicationcontext.xml文件,如果你的spring配置文件配置了好多,可以采取  context-param的參數來解決
            <listener>
              <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
             </listener>
          4。struts2的標簽無法讀取
            Servlet.service() for servlet jsp threw exception
             java.lang.NullPointerException
             at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
             at org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:52)
             在web.xml中加入
          <filter-mapping>
            <filter-name>struts2</filter-name>
            <url-pattern>/*</url-pattern>
           </filter-mapping〉


          From: http://blog.csdn.net/qiuxiao1981/archive/2007/10/19/1832852.aspx


          經過本人測試主要是由于web.xml中少了如下listener的配置:

              <listener>
                  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
              </listener>
          posted on 2008-01-21 12:36 Joshua Yan 閱讀(1981) 評論(0)  編輯  收藏 所屬分類: Java
          主站蜘蛛池模板: 马公市| 西乌珠穆沁旗| 离岛区| 西盟| 澄迈县| 西和县| 白玉县| 西安市| 甘孜县| 齐河县| 黄冈市| 望江县| 左云县| 海南省| 邹城市| 东光县| 屏山县| 绍兴县| 洛扎县| 锦州市| 民乐县| 宿迁市| 长寿区| 砚山县| 巴林左旗| 垫江县| 昌都县| 汾西县| 密山市| 茶陵县| 嘉义县| 宜兰市| 东乡族自治县| 安义县| 阳谷县| 大石桥市| 左云县| 合作市| 卫辉市| 赤峰市| 雷山县|