Search code examples
javastruts2maven-3m2eclipse

How to fix "addConfigurationProvider(Xml...) is undefined" error in struts 2 blank archetype generated from m2eclipse plugin with Indigo?


I created a blank struts 2 archetype using maven 3, m2eclipse plugin for eclipse Indigo. I encountered this error after project generation.

The method addConfigurationProvider(XmlConfigurationProvider) is undefined for the type ConfigurationManager

This is from the ConfigTest.java

 protected void setUp() throws Exception {
        super.setUp();
        XmlConfigurationProvider c = new XmlConfigurationProvider("struts.xml");
        configurationManager.addConfigurationProvider(c);
        configurationManager.reload();
    }

How do I resolve this?
Thanks in advance.


Solution

  • The method addConfigurationProvider was marked as deprecated and replaced by addContainerProvider. With version 2.3.x this method was removed.

    That was the bug with the struts2-archetype-blank.I believe you need to change the following settings

    configurationManager.addConfigurationProvider(c);
    

    to this:

    configurationManager.addContainerProvider( c );
    

    I hope this fill fix your issue