0

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>
ETS
  • 516
  • 2
  • 7
  • 15

2 Answers2

0

Try this:

  1. Close your eclipse (or other IDE);
  2. Go to this folder on your PC C:/Users/M/.m2/repository/ and delete everything in it;
  3. Open your project and update Maven Project (Alt+F5 in eclipse).

This steps will restore all jars in your local repository and will fix all conflicts, if there any.

0

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

ETS
  • 516
  • 2
  • 7
  • 15