Struts2 Error when Deploying: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory

前端 未结 5 632
暗喜
暗喜 2021-01-18 09:00

I\'m creating a basic Struts2, Maven webApp and getting this error when I deploy to Tomcat 6 or Jetty. Has anyone seen this?

  2010-07-29 15:33:38.801::WARN         


        
5条回答
  •  南笙
    南笙 (楼主)
    2021-01-18 09:40

    Your problem is actually quite clear if you read the stack trace:

    Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the 
    name xwork has already been loaded by bean -
    jar:file:/C:/workspaces/ulearn/ulearn/target/work/webapp/WEB-INF/lib/struts2-core-2.0.11.2.jar!/struts-default.xml:30:72
     - bean -
    jar:file:/C:/workspaces/ulearn/ulearn/target/work/webapp/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:29:72
    

    You have a copy of struts2-core-2.0.11.2.jar and a copy of struts2-core-2.1.8.1.jar in your WEB-INF/lib directories. I think you should only have one of them. Do some cleanup (running a mvn clean might be enough).


    PS: I have no idea why you also have stuff coming from C:/workspace/test as show be the first line:

    jar:file:/C:/workspaces/test/test/target/work/webapp/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:29:72
    

    There is definitely something weird and messy with your classpath. I don't have any explanation beyond the one I gave above though.

提交回复
热议问题