使用weblogic开发web项目时,会遇到com.opensymphony.xwork2.ObjectFactory被重复加载的问题,
错误信息如下所示:
class="java">
Unable to load configuration. - bean - zip:D:/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/_auto_generated_ear_/nggglf/war/WEB-INF/lib/struts2-core-2.3.15.1.jar!/struts-default.xml:29:72
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:502)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:332)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
Truncated. see log file for complete stacktrace
Caused By: Unable to load configuration. - bean - zip:D:/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/_auto_generated_ear_/nggglf/war/WEB-INF/lib/struts2-core-2.3.15.1.jar!/struts-default.xml:29:72
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
Truncated. see log file for complete stacktrace
Caused By: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - zip:D:/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/_auto_generated_ear_/nggglf/war/WEB-INF/lib/struts2-core-2.3.15.1.jar!/struts-default.xml:29:72
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:245)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:226)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446)
Truncated. see log file for complete stacktrace
Caused By: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - zip:F:/develop/apache-maven-3.0.4/repository/org/apache/struts/struts2-core/2.3.15.1/struts2-core-2.3.15.1.jar!/struts-default.xml:29:72 - bean - zip:D:/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/_auto_generated_ear_/nggglf/war/WEB-INF/lib/struts2-core-2.3.15.1.jar!/struts-default.xml:29:72
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:229)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:226)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446)
Truncated. see log file for complete stacktrace
>
此时需要对weblogic服务进行设置一下即可:在Servers视图下右键weblogic服务器->Properties->Weblogic->Publishing-> 在Publishing mode 选择Publish as an exploded archive即可