Make sure struts2-plugin is configured in the pom.xml used to build the war

<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
    <parent>
        <artifactId>struts2-plugins</artifactId>
        <groupId>org.apache.struts</groupId>
        <version>2.1.2</version>
    </parent>

/*where /src/main/resources/struts-plugin.xml contains */
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd";>
    
<struts>
    <bean type="com.opensymphony.xwork2.ObjectFactory" name="spring" 
class="org.apache.struts2.spring.StrutsSpringObjectFactory" />
    
    <!--  Make the Spring object factory the automatic default -->
    <constant name="struts.objectFactory" value="spring" />

    <package name="spring-default">
        <interceptors>
            <interceptor name="autowiring" 
class="com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor"/>
            <interceptor name="sessionAutowiring" 
class="org.apache.struts2.spring.interceptor.SessionContextAutowiringInterceptor"/>
        </interceptors>
    </package>    
</struts>

HTH/
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business 
of Sender. This transmission is of a confidential nature and Sender does not 
endorse distribution to any party other than intended recipient. Sender does 
not necessarily endorse content contained within this transmission. 




> From: sidharth.bhat...@gmail.com
> To: user@struts.apache.org
> Subject: Getting a spring error and need help.
> Date: Mon, 26 Jan 2009 17:03:25 -0500
> 
> Hey guys,
> 
>  
> 
> I am getting the following spring error:
> 
>  
> 
> Cannot locate the chosen ObjectFactory implementation: spring - [unknown
> location]
> 
>                 at
> org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.
> java:224)
> 
>                 at
> org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.
> java:195)
> 
>                 at
> org.apache.struts2.config.BeanSelectionProvider.register(BeanSelectionProvid
> er.java:153)
> 
>                 at
> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfi
> guration.java:131)
> 
>                 at
> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(Configu
> rationManager.java:52)
> 
>                 at
> org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatche
> r.java:395)
> 
>                 at
> org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
> 
>                 at
> org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:20
> 1)
> 
>                 at
> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilter
> Config.java:275)
> 
>                 at
> org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFil
> terConfig.java:397)
> 
>                 at
> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterCon
> fig.java:108)
> 
>                 at
> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:37
> 09)
> 
>                 at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4363)
> 
>                 at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7
> 91)
> 
>                 at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
> 
>                 at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
> 
>                 at
> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)
> 
>                 at
> org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:719)
> 
>                 at
> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
> 
>                 at
> org.apache.catalina.startup.HostConfig.check(HostConfig.java:1217)
> 
>                 at
> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
> 
>                 at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
> t.java:117)
> 
>                 at
> org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:
> 1337)
> 
>                 at
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processC
> hildren(ContainerBase.java:1601)
> 
>                 at
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processC
> hildren(ContainerBase.java:1610)
> 
>                 at
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(Cont
> ainerBase.java:1590)
> 
>                 at java.lang.Thread.run(Unknown Source)
> 
> I am using Spring 2.5.6, struts2=core-2.0.11.2 and
> strut2-spring=plugin-2.0.11.2
> 
> My Struts.xml file has:
> 
>  
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> 
> <!DOCTYPE struts PUBLIC
> 
> "-//Apache Software Foundation//DTD Struts Configuration
> 
> 2.0//EN"
> 
> "http://struts.apache.org/dtds/struts-2.0.dtd";>
> 
> <struts>
> 
>  
> 
> <package name="testpackage" extends="struts-default" >
> 
>       <action name="index" class="com.sbconsulting.war.actions.HomeAction" >
> 
>             <result>index.jsp</result>
> 
>       </action>
> 
> </package>
> 
> </struts>
> 
>  
> 
> My web.xml file has:
> 
>  
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns="http://java.sun.com/xml/ns/javaee";
> xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; id="WebApp_ID"
> version="2.5">
> 
>   <display-name>Me</display-name>
> 
>   <context-param>
> 
>             <param-name>contextConfigLocation</param-name>
> 
>             <param-value>classpath*:applicationContext*.xml</param-value>
> 
>   </context-param>
> 
>   <filter>
> 
>       <filter-name>action2</filter-name>
> 
>       <filter-class>
> 
>             org.apache.struts2.dispatcher.FilterDispatcher
> 
>       </filter-class>
> 
>       <init-param>
> 
>             <param-name>config</param-name>
> 
>             <param-value>/WEB-INF/struts.xml</param-value>
> 
>         </init-param>
> 
>         <init-param>
> 
>             <param-name>actionPackages</param-name>
> 
>             <param-value>war.actions</param-value>
> 
>         </init-param>
> 
>   </filter>
> 
>   <filter-mapping>
> 
>     <filter-name>action2</filter-name>
> 
>     <url-pattern>/*</url-pattern>
> 
>   </filter-mapping>
> 
>   <listener>
> 
>  
> <listener-class>org.springframework.web.context.ContextLoaderListener</liste
> ner-class>
> 
>     </listener>
> 
>   <servlet>
> 
>       <servlet-name>jspSupportServlet</servlet-name>
> 
>  
> <servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
> 
>       <load-on-startup>5</load-on-startup>
> 
>     </servlet>
> 
>     
> 
>   <welcome-file-list>
> 
>     <welcome-file>index.action</welcome-file>
> 
>   </welcome-file-list>
> 
> </web-app>
> 
>  
> 
> Any help appreciated. 
> 
>  
> 
> thanks,
> 
> Sid Bhatia
> "Try not. Do...  or do not. There is no try" -- Yoda
> _________________________
> *  <mailto:sidharth.bha...@lehman.com> mailto:sidharth.bhat...@gmail.com 
> 
>  
> 

_________________________________________________________________
Windows Live™ Hotmail®:…more than just e-mail. 
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_explore_012009

Reply via email to