简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM