Search code examples
struts2strutsstruts-config

struts2 configuration bean issue


Recently i started looking into struts2 and I've been noticing this weird problem

Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name struts has already been loaded by bean - jar:file:/C:/Users/M/.m2/repository/org/apache/struts/struts2-core/2.5.13/struts2-core-2.5.13.jar!/struts-default.xml:75:72

In the stack it complains about the bean already loaded with the same jar. I noticed couple questions regarding this, but nothing fixed the issue. I am not using two struts2-core jars, both same version. I did mvn clean,but that didn't fix the issue.

The issue is intermittent, sometimes it just works fine and sometimes it fails.

pom.xml

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>2.5.13</version>
        </dependency>

Solution

  • I tried clearing all the jars from .m2 folder, I also tried removing the jar from the target folders, re importing all maven dependencies. But that didn't work.

    The issue was due to intellij iml file, there was a struts2 library entry that i needed to delete