weblogic struts2 报错。。大侠们帮帮忙啊~

时间:2022-09-05 21:14:02
项目在tomcat下启动没有问题,但是部署到weblogic后就报错:
<2010-4-20 下午02时54分57秒 CST> <Error> <HTTP> <BEA-101165> <Could not load use
r defined filter in web.xml: org.apache.struts2.dispatcher.FilterDispatcher.
Unable to load configuration. - [unknown location]
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(
ConfigurationManager.java:58)
        at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Di
spatcher.java:371)
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424)
        at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.
java:213)
        at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterMa
nager.java:329)
        Truncated. see log file for complete stacktrace
Error loading configuration file struts.xml - [unknown location]
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loa
dDocuments(XmlConfigurationProvider.java:165)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.ini
t(XmlConfigurationProvider.java:130)
        at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContai
ner(DefaultConfiguration.java:155)
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(
ConfigurationManager.java:55)
        at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Di
spatcher.java:371)
        Truncated. see log file for complete stacktrace
unable to attain an URLClassLoader - [unknown location]
        at com.opensymphony.xwork2.util.ClassPathFinder.findMatches(ClassPathFin
der.java:80)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loa
dConfigurationFiles(XmlConfigurationProvider.java:908)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loa
dDocuments(XmlConfigurationProvider.java:161)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.ini
t(XmlConfigurationProvider.java:130)
        at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContai
ner(DefaultConfiguration.java:155)
        Truncated. see log file for complete stacktrace
>



struts2-core-2.1.2.jar和struts2-spring-plugin-2.1.2.jar我都引入了,
不知道是什么原因啊。。。。。

7 个解决方案

#1


把commons-io-1.3.2, commons-fileupload.1.2.1加进去

#2


都加进去了,还不行
2011-05-18 16:45:01,078[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'][][ERROR]Dispatcher initialization failed method
:com.opensymphony.xwork2.util.logging.commons.CommonsLogger.error(CommonsLogger.java:38)
Unable to load configuration. - [unknown location]
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
        at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
        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:332)
        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:98)
        at weblogic.servlet.internal.FilterManager.preloadFilters(FilterManager.java:59)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1876)
        at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
        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:636)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
        at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:43)
        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
        at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
        at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
        at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
        at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
        at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
        at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
        at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
        at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
        at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: Error loading configuration file struts.xml - [unknown location]
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:158)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:121)
        at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:179)
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
        ... 41 more
Caused by: unable to attain an URLClassLoader - [unknown location]
        at com.opensymphony.xwork2.util.ClassPathFinder.findMatches(ClassPathFinder.java:80)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:951)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:154)
        ... 44 more
<2011-5-18 下午04时45分01秒 CST> <Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.ng.filter.St
rutsPrepareAndExecuteFilter.
Unable to load configuration. - [unknown location]
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:428)
        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:332)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        Truncated. see log file for complete stacktrace
Caused By: Unable to load configuration. - [unknown location]
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
        at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
        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: Error loading configuration file struts.xml - [unknown location]
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:158)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:121)
        at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:179)
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
        at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
        Truncated. see log file for complete stacktrace
Caused By: unable to attain an URLClassLoader - [unknown location]
        at com.opensymphony.xwork2.util.ClassPathFinder.findMatches(ClassPathFinder.java:80)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:951)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:154)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:121)
        at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:179)
        Truncated. see log file for complete stacktrace
>

#3


在我看来这种问题最好的解决办法就是修改你的struts.xml配置文件include里面的通配符*
有多少个文件就include多少个文件,不要采用通配符。
因为我跟踪了一下代码,发现报这个错误在于xwork的ClassPathFinder.findMatches方法里取得当前classloader的方式是ClassLoader loader = Thread.currentThread().getContextClassLoader();
在tomcat环境下取到的是URLClassloader的实例,而在weblogic下面却是weblogic.utils.classloaders.ChangeAwareClassLoader ,weblogic有自己的classLoader机制,因此导致了错误。我觉得解决此类问题除非weblogic自身去解决,比如继承URLClassLoader等。
如果你自己尝试解决,即使解决了,可能也会出现这样那样的问题。因此,还是按照最普通的方式,老老实实的将所有的文件都一个一个include进来吧。

#4


3楼完全正解!!

#5


3楼完全正解!!+1
为这个问题 折腾了老长时间,谢谢

#6


确实是这样的,鄙视他妈比的weblogic...

#7


该回复于2012-09-25 13:08:04被版主删除

#1


把commons-io-1.3.2, commons-fileupload.1.2.1加进去

#2


都加进去了,还不行
2011-05-18 16:45:01,078[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'][][ERROR]Dispatcher initialization failed method
:com.opensymphony.xwork2.util.logging.commons.CommonsLogger.error(CommonsLogger.java:38)
Unable to load configuration. - [unknown location]
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
        at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
        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:332)
        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:98)
        at weblogic.servlet.internal.FilterManager.preloadFilters(FilterManager.java:59)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1876)
        at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
        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:636)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
        at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:43)
        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
        at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
        at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
        at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
        at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
        at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
        at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
        at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
        at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
        at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: Error loading configuration file struts.xml - [unknown location]
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:158)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:121)
        at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:179)
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
        ... 41 more
Caused by: unable to attain an URLClassLoader - [unknown location]
        at com.opensymphony.xwork2.util.ClassPathFinder.findMatches(ClassPathFinder.java:80)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:951)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:154)
        ... 44 more
<2011-5-18 下午04时45分01秒 CST> <Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.ng.filter.St
rutsPrepareAndExecuteFilter.
Unable to load configuration. - [unknown location]
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:428)
        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:332)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        Truncated. see log file for complete stacktrace
Caused By: Unable to load configuration. - [unknown location]
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
        at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
        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: Error loading configuration file struts.xml - [unknown location]
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:158)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:121)
        at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:179)
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
        at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
        Truncated. see log file for complete stacktrace
Caused By: unable to attain an URLClassLoader - [unknown location]
        at com.opensymphony.xwork2.util.ClassPathFinder.findMatches(ClassPathFinder.java:80)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:951)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:154)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:121)
        at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:179)
        Truncated. see log file for complete stacktrace
>

#3


在我看来这种问题最好的解决办法就是修改你的struts.xml配置文件include里面的通配符*
有多少个文件就include多少个文件,不要采用通配符。
因为我跟踪了一下代码,发现报这个错误在于xwork的ClassPathFinder.findMatches方法里取得当前classloader的方式是ClassLoader loader = Thread.currentThread().getContextClassLoader();
在tomcat环境下取到的是URLClassloader的实例,而在weblogic下面却是weblogic.utils.classloaders.ChangeAwareClassLoader ,weblogic有自己的classLoader机制,因此导致了错误。我觉得解决此类问题除非weblogic自身去解决,比如继承URLClassLoader等。
如果你自己尝试解决,即使解决了,可能也会出现这样那样的问题。因此,还是按照最普通的方式,老老实实的将所有的文件都一个一个include进来吧。

#4


3楼完全正解!!

#5


3楼完全正解!!+1
为这个问题 折腾了老长时间,谢谢

#6


确实是这样的,鄙视他妈比的weblogic...

#7


该回复于2012-09-25 13:08:04被版主删除