struts2学习小问题解决

感觉struts2一直在身边,但很久没有系统的复习struts2了,现正好有时间做一两个个struts2例子想对此有深入的理解,下面是过程中遇到的问题(也就是报的错),都是通过各个网站查出来的答案,这里按我解决的顺序总结起来罢了,以备后续同样问题再次发生。

启动struts2工程报如下错误:
1、Struts2引发的启动异常
2010-9-26 22:27:16 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
严重: Dispatcher initialization failed
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
     at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:295)
     at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:431)
     at com.opensymphony.xwork2.inject.ContainerBuilder$5.create(ContainerBuilder.java:207)
     at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)

解决:把javassist-3.11.0.GA.jar包放到lib目录下面,此包来自:struts2.3.1-all.zip/apps/struts2-blank.war/WEB-INF/lib,将struts2-blank-2.2.1.war包放入tomcat根目录(apache-tomcat-6.0.29\webapps),启动tomcat此包会自动解压,找到javassist-3.11.0.GA.jar加入工程即可。

2、如下异常:
Parsing configuration file [struts-default.xml]
Parsing configuration file [struts-plugin.xml]
Parsing configuration file [struts.xml]
Overriding property struts.i18n.reload - old value: false new value: true
Overriding property struts.configuration.xml.reload - old value: false new value: true
Loading global messages from ApplicationMessage
Initializing Struts-Spring integration...
********** FATAL ERROR STARTING UP STRUTS-SPRING INTEGRATION **********
Looks like the Spring listener was not configured for your web app!
Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.
You might need to add the following to web.xml:
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
Dispatcher initialization failed
java.lang.NullPointerException

解决:在工程中删除struts2-spring-plugin-2.2.1.1.jar包。

 

3、又一个异常:
Parsing configuration file [struts-default.xml]
Parsing configuration file [struts-plugin.xml]
Parsing configuration file [struts.xml]
Overriding property struts.i18n.reload - old value: false new value: true
Overriding property struts.configuration.xml.reload - old value: false new value: true
Loading global messages from ApplicationMessage
Dispatcher initialization failed
java.lang.RuntimeException: java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='actionPackages'] in public void org.apache.struts2.config.ClasspathPackageProvider.setActionPackages(java.lang.String).
    at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132)
    at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)
    at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:507)
    at com.opensymphony.xwork2.inject.ContainerImpl$8.call(ContainerImpl.java:540)
    at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:574)
    at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:538)

解决:删掉 struts2-codebehind-plugin-2.2.1.1.jar 包

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值