无法在weblogic上运行struts2 web应用程序

时间:2017-06-09 03:26:24

标签: java struts2

我根据网络教程制作了struts2 web应用程序。 它将部署到weblogic服务器10.3.6。 (JDK1.6)在我的开发人员机器中,我在eclipse中添加了服务器。但是当我运行它时,它会显示以下错误。我在网上研究并尝试修复。应该没有找到重复的罐子。请帮忙。

ERROR org.apache.struts2.dispatcher.Dispatcher - Dispatcher initialization failed
com.opensymphony.xwork2.config.ConfigurationException: Unable to load configuration.
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
    at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:343)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.FilterManager.loadFilter(FilterManager.java:96)
    at weblogic.servlet.internal.FilterManager.preloadFilters(FilterManager.java:57)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1872)
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3154)
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1518)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:484)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:671)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
    at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:59)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
    at weblogic.deploy.internal.targetserver.operations.StartOperation.doCommit(StartOperation.java:149)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
    at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused by: com.opensymphony.xwork2.config.ConfigurationException: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:221)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:169)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
    ... 43 common frames omitted
Caused by: com.opensymphony.xwork2.config.ConfigurationException: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - zip:C:/Users/raymondchiu/.m2/repository/org/apache/struts/struts2-core/2.1.8/struts2-core-2.1.8.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:205)
    ... 46 common frames omitted
<2017年6月9日 上午11時20分31秒 CST> <Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.
Unable to load configuration. - bean - zip:C:/Oracle_Home/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/_auto_generated_ear_/3tqe0y/war/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:29:72
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
    at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:343)
    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:C:/Oracle_Home/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/_auto_generated_ear_/3tqe0y/war/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
    Truncated. see log file for complete stacktrace
Caused By: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - zip:C:/Oracle_Home/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/_auto_generated_ear_/3tqe0y/war/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:221)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:169)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
    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:C:/Users/raymondchiu/.m2/repository/org/apache/struts/struts2-core/2.1.8/struts2-core-2.1.8.jar!/struts-default.xml:29:72 - bean - zip:C:/Oracle_Home/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/_auto_generated_ear_/3tqe0y/war/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:205)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:169)
    at igurationManager.getConfiguration(ConfigurationManager.java:55)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
    Truncated. see log file for complete stacktracecom.opensymphony.xwork2.config.Conf
> 

1 个答案:

答案 0 :(得分:0)

我几次遇到过这个问题,特别是在使用WebLogic 10.3.x,Eclipse和Maven时。

问题是Eclipse的WebLogic服务器插件会将所有依赖项添加到类路径两次。

我有一个可能适用或不适合您的解决方法(取决于您的应用程序的架构)。

首先,您必须将应用程序部署为展开的存档。您可以在Eclipse中的WebLogic服务器属性下找到此设置(在“发布”配置节点下)。

其次,您必须将应用程序部署为 war项目(而不是耳朵)。

请注意,对于较新版本的WebLogic,这不是问题。我一直在Eclipse中将ear项目部署到WebLogic 12c而没有任何问题。我只有在部署到WebLogic 11g(10.3.x)时描述的问题。