> If you are using the Spring Framework with your App, you should be able to
> define your TextProvider, with all it's dependencies, as a Spring Bean, then
> when you define the <bean> in Struts use the Spring Bean ID instead of using
> the full class name.  Struts will use that Spring Bean in place of creating a 
> new
> one.
>   (*Chris*)

Okay.  I'm following this path.  I've got the Spring Plugin in place.  And it's 
working.  I verified it by autowiring a trivial spring bean into one of my 
actions.  But when I try to create my custom textprovider and then have it used 
as the framework default text provider I'm getting some initialization 
problems.  Here's what I'm doing:

1) spring config   

        <bean id="customTextProvider" 
class="com.mycompany.textsupport.MyTextProviderSupport"/>

2) struts.xml

          <bean type="com.opensymphony.xwork2.TextProvider" 
name="myTextProvider" class="customTextProvider" scope="default" />
         <constant name="struts.xworkTextProvider" value="myTextProvider"/>

But when I start the app I get the following error, thrown when the framework 
tries to create the text provider bean.  It seems like the framework isn't 
recognizing that I'm referencing a spring bean with the class attribute . . . 

2012-10-15 15:41:39,763 ERROR [pool-2-thread-1]-commons.CommonsLogger: 
Dispatcher initialization failed
Unable to load configuration. - bean - 
file:/opt/apache-tomcat/catalina_base/imf/WEB-INF/classes/struts.xml:8:119
        at 
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
        at 
org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)
        at 
org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:193)
        at 
org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
        at 
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
        at 
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
        at 
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
        at 
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)
        at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
        at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: Unable to load bean: type:com.opensymphony.xwork2.TextProvider 
class: customTextProvider - bean - 
file:/opt/apache-tomcat/catalina_base/imf/WEB-INF/classes/struts.xml:8:119
        at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:243)
        at 
org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
        at 
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:210)
        at 
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
        ... 17 more
Caused by: java.lang.ClassNotFoundException: customTextProvider
        at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
        at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
        at 
com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:152)
        at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:214)

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to