qiuxiao1981的专栏

技术流.我是新手

原创 struts2错误初步2收藏

新一篇: struts2与spring结合 | 旧一篇: struts2.0在action里获得servlet对象方法

当把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
    class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean - jar:file:/C:/Program%
    20Files/tomcat5.5.23/webapps/Hello/WEB-INF/lib/struts2-spring-plugin-2.0.6.jar!/struts-
   plugin.xml:8:132
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〉
 

发表于 @ 2007年10月19日 15:03:00|评论(loading...)|编辑

新一篇: struts2与spring结合 | 旧一篇: struts2.0在action里获得servlet对象方法

评论

#jit_my_id 发表于2007-10-25 17:48:21  IP: 61.178.32.*
我试验了一下好像还是不行
#qiuxiao1981 发表于2007-10-27 13:39:07  IP: 210.82.55.*
在tomcat5.0下必须把Tomcat里面的common\endorsed的xml-api.jar给删除。
#lyhwlj 发表于2007-12-09 18:39:28  IP: 125.34.179.*
我照你说的也加了applicationContent.xml
可是一运行,会出现404错误
不知道是怎么回事
这是我的qq272317361
希望得到您不帮助
每晚在线
急急!!!!
#qiuxiao1981 发表于2008-01-11 08:57:25  IP: 210.82.55.*
404错误是没有找到文件,应该与这个没有关系
发表评论  


当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
Csdn Blog version 3.1a
Copyright © qiuxiao1981