struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andriy Pererva <>
Subject Re: Struts 2 custom ClassLoader
Date Wed, 09 Sep 2009 10:25:11 GMT
Hello, Wes!
Thank you for your quick help! I did exactly what you advised me, but
something still doesn't work. Here are my steps:
1) Created CustomObjectFactory which extends StrutsObjectFactory, with
only one method overriden - setClassLoader(). Inside this method I
simply pass my custom classloader to super.setClassLoader().
2) Inserted in my struts.xml (right after struts-default.xml
inclusion) next strings:
  <bean type="com.opensymphony.xwork2.ObjectFactory"
class="efi.base.web.framework.CustomObjectFactory" />
  <constant name="struts.objectFactory" value="customFactory"/>
After that I tried to debug my CustomObjectFactory in Eclipse, but my
overriden method setClassLoader() hasn't been invoked during struts
Currently we are using Struts 2.0.11.
Please, tell me what I'm doing wrong? What is the most neat way to
intelligently pass my classloader to Struts?
Again, thank you in advance for you answer!

With best regards,

On Thu, Sep 3, 2009 at 4:39 PM, Wes Wannemacher<> wrote:
> I would suggest creating your own plugin... If the custom classes are
> actions, validators, interceptors and type converters then just take a
> look at the spring plugin for an example. You will want to write your
> own implementation of the ObjectFactory, the ObjectFactory is in
> charge of creating the struts2 app's actions, validators,
> interceptors, type converters and beans.
> As far as enhancing the functionality of struts.xml processing, I
> would first suggest you see if you can retrofit your application to
> work with one of the existing plugins like 'conventions'. I only say
> this because enhancing the XmlConfigurationProvider is quite a bit
> more daunting than extending the ObjectFactory. If you really can't
> adopt an existing plugin for configuration, then create an
> implementation of ConfigurationProvider and take a look at the
> StrutsXmlConfigurationProvider and see if you can get the dispatcher
> to honor your new ConfigurationProvider.
> -Wes
> On Thu, Sep 3, 2009 at 9:33 AM, Andriy Pererva<> wrote:
>> Hi, all!
>> I'm working on a big java web project, which is based on Struts 2
>> framework. Now we are going to do some refactoring and split the
>> project up in some parts: core and other auxillary functionality
>> modules. Core classes located under classpath, but all the auxillary
>> functionality classes will be moved to database and loaded via our
>> custom ClassLoader. Among these classes there are some Stuts actions
>> and part of the struts.xml file with appropriate mapping.
>> How can I make Struts 2 aware of my custom ClassLoader in order to
>> load these auxillary action classes from DB. Currently Struts cannot
>> find and instantinate any of them
>> Any suggestions would be very appreciated!
>> Thank you in advance for any useful answer.
>> With best regards,
>> Andriy.
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:
> --
> Wes Wannemacher
> Head Engineer, WanTii, Inc.
> Need Training? Struts, Spring, Maven, Tomcat...
> Ask me for a quote!
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message