struts 2学习(有关Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory的错误)
2014-03-04 10:11
405 查看
struts 2 有感 待续
觉得 struts2 的官方网站上的第一个例子不是太好, 我开始试的时候,
把 struts2 的所有的 jar 包 都放到web-inf/lib 下了, 结果老出错
就是下面的两个错:
-------------------------------------------------------------------
Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean - jar:file:/D:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testStruts/WEB-INF/lib/struts2-spring-plugin-2.0.6.jar!/struts-plugin.xml:8:132
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:208)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware
---------------------------------------------------------------------
其他的地方都检查了好几遍 但是一运行tomcat 就出错, 找了半天原因原来是
没看到下面这句话 http://struts.apache.org/2.x/docs/simple-setup.html
If any Struts 2 Plugins are included, then other JARs may be needed too. For example, the optional Spring Plugin requires the Spring JARs to be present.
我的理解:它的问题是引入了插件,然后解释说,任何插件可能也需要其他的JAR文件,所以他的做法试试删除不需要的插件
这对初学者也要求太高了吧, 要是不知道 Spring 是的什么东西就不要用struts2 了。
去掉了那几个jar包, (简单的,留下xwork-2.0.4.jar、commons-logging-1.0.4.jar、freemarker-2.3.8.jar、ognl-2.6.11.jar、struts2-core-2.0.11.jar)就可以运行了。
以上是转写的,下面是我遇到的问题:
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
<version>2.2.3</version>
</dependency>
struts2-convention-plugin.jar进入后,发现和struts2的core包冲突了,这样情况启动时也是不知道如何加载
解决办法当然是删除掉core就OK了
觉得 struts2 的官方网站上的第一个例子不是太好, 我开始试的时候,
把 struts2 的所有的 jar 包 都放到web-inf/lib 下了, 结果老出错
就是下面的两个错:
-------------------------------------------------------------------
Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean - jar:file:/D:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testStruts/WEB-INF/lib/struts2-spring-plugin-2.0.6.jar!/struts-plugin.xml:8:132
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:208)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware
---------------------------------------------------------------------
其他的地方都检查了好几遍 但是一运行tomcat 就出错, 找了半天原因原来是
没看到下面这句话 http://struts.apache.org/2.x/docs/simple-setup.html
If any Struts 2 Plugins are included, then other JARs may be needed too. For example, the optional Spring Plugin requires the Spring JARs to be present.
我的理解:它的问题是引入了插件,然后解释说,任何插件可能也需要其他的JAR文件,所以他的做法试试删除不需要的插件
这对初学者也要求太高了吧, 要是不知道 Spring 是的什么东西就不要用struts2 了。
去掉了那几个jar包, (简单的,留下xwork-2.0.4.jar、commons-logging-1.0.4.jar、freemarker-2.3.8.jar、ognl-2.6.11.jar、struts2-core-2.0.11.jar)就可以运行了。
以上是转写的,下面是我遇到的问题:
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
<version>2.2.3</version>
</dependency>
struts2-convention-plugin.jar进入后,发现和struts2的core包冲突了,这样情况启动时也是不知道如何加载
解决办法当然是删除掉core就OK了
相关文章推荐
- struts 2学习(有关Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory的错误)
- struts 2学习(有关Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory的错误)
- struts 2学习(有关Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory的错误)
- struts 2学习(有关Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory的错误)
- struts 2学习:有关Unable to load bean 的Bug
- 严重:Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/E:/Tomc
- Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/E:/workspa
- Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file 2010-08-03
- org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class: org.apache.struts.taglib.bean.CookieTei错误解决方法。
- Unable to load bean: type: struts-derfault.xml异常
- Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar
- Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - b
- Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar
- Unable to load class 'org.codehaus.groovy.runtime.typehandling.ShortTypeHandling'错误解决办法
- struts Unable to load bean 错误
- Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar
- Struts2 Unable to load configuration. - bean - jar ..... WEB-INF/lib/struts2-core-2.1.2.jar!/struts-default.xml:46:178 解决办法
- Caused by: Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory class:org.apache.struts2.
- 使用struts和spring开发时遇到Unable to load configuration. - action - |Caused by: Action class [login] not found - action -
- JAR包不全!Unable to load configuration.-bean-jar:file:/.../struts2-core-2.2.1.jar!/struts-default.xml:7