Struts2 报这样的错误,怎么解决?

我在家学习Struts2,按百度经验的方法,在Myeclipse搭建Struts2环境,写了些简单的东西测试一下,启动报这样的错误,怎么解决:You might need to add the following to web.xml:
org.springframework.web.context.ContextLoaderListener
``````````````````````(省略一些东西)严重: Dispatcher initialization failedjava.lang.NullPointerException at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:220)``````````````````````(省略一些东西)严重: Exception starting filter struts2Class: com.opensymphony.xwork2.spring.SpringObjectFactoryFile: SpringObjectFactory.javaMethod: getClassInstanceLine: 220 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1``````````````````````(省略一些东西)Caused by: java.lang.NullPointerException at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:220)``````````````````````(省略一些东西)严重: Exception starting filter struts2java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter我怀疑是包冲突造成的。我没添加其他东西啊,直接按照百度经验搭建 的Struts2环境。请帮助解决,十分感激!

这个不是包冲突造成的,包冲突会报classnotfoundexception
这个错误是由于没有导入struts核心包造成的,把包结构图给我看下。追问

追答

没有看到你的包:
处理方法:
核对lib包 如下:
commons-fileupload-1.2.1.jar,
commons-io-1.3.2.jar
commons-logging-1.0.4.jar
freemarker-2.3.16.jar
ognl-3.0.jar
struts2-core-2.2.1.jar
xwork-core-2.2.1.jar

追问

包好多,但删不掉啊,怎么删?

右边的删除键是灰色的。这是myeclipse 自带的不包,我按百度经验步骤搭的Struts2环境。

以下是搭建的连接:http://jingyan.baidu.com/article/ed2a5d1f3353d709f6be17a6.html

温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答