简体   繁体   中英

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>

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.

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

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