Cannot locate the chosen ObjectFactory implementation: spring

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Cannot locate the chosen ObjectFactory implementation: spring相关的知识,希望对你有一定的参考价值。

错误信息:

Caused by: Cannot locate the chosen ObjectFactory implementation: spring - [unknown location]
    at org.apache.struts2.config.AbstractBeanSelectionProvider.alias(AbstractBeanSelectionProvider.java:74)
    at org.apache.struts2.config.AbstractBeanSelectionProvider.alias(AbstractBeanSelectionProvider.java:45)
    at org.apache.struts2.config.DefaultBeanSelectionProvider.register(DefaultBeanSelectionProvider.java:363)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:240)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
    ... 18 more

背景:

引入Struts基本必需包:
    commons-lang3-3.2.jar
    commons-fileupload-1.3.1.jar
    commons-io-2.2.jar
    freemarker-2.3.22.jar
    javassist-3.11.0.GA.jar
    ognl-3.0.6.jar
    struts2-core-2.3.24.1.jar
    xwork-core-2.3.24.1.jar
    
引入Spring-Web包:
    aopalliance-1.0.jar
    commons-logging-1.1.1.jar
    spring-aop-4.2.4.RELEASE.jar
    spring-beans-4.2.4.RELEASE.jar
    spring-context-4.2.4.RELEASE.jar
    spring-core-4.2.4.RELEASE.jar
    spring-expression-4.2.4.RELEASE.jar
    spring-web-4.2.4.RELEASE.jar

Struts.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
    "http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>
   ......
    <!-- 指定由spring负责action对象的创建 -->
    <constant name="struts.objectFactory" value="spring" />
   ......
</struts>

这个时候报这个错误原因就是还缺少一个jar包:
    struts2-spring-plugin-2.3.15.1.jar   它是整合Struts和Spring的Jar

以上是关于Cannot locate the chosen ObjectFactory implementation: spring的主要内容,如果未能解决你的问题,请参考以下文章

电脑中VS提示The NET CLI tools cannot be located怎么解决

关于eclipse的Description:Resource Path Location Type The project cannot be built until build path error

Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layou

[ 娱乐算法 ] 位面之子算法 - The Chosen One Algorithm - Matlab code

[ 娱乐算法 ] 位面之子算法 - The Chosen One Algorithm - Matlab code

[ 娱乐算法 ] 位面之子算法 - The Chosen One Algorithm - Matlab code