问题描述
我为grails应用程序创建了一个WAR,并将其部署到Weblogic 12c服务器中时,出现以下异常
I create a WAR for my grails application and when I deploy it in Weblogic 12c server I get the following Exception
<Mar 27, 2012 12:38:55 PM PDT> <Warning> <HTTP> <BEA-101162> <User defined listener org.codehaus.groovy.grails.web.context.GrailsC
ontextLoaderListener failed: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/Strin
g;ILjava/lang/String;Ljava/lang/Throwable;)V.
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/la
ng/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:159)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:582)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
Truncated. see log file for complete stacktrace
>
<Mar 27, 2012 12:38:55 PM PDT> <Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.codehaus.groovy.gra
ils.web.sitemesh.GrailsPageFilter.
com.opensymphony.module.sitemesh.factory.FactoryException: Could not initialize DecoratorMapper : org.codehaus.groovy.grails.web.s
itemesh.GrailsLayoutDecoratorMapper: java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener reg
istered?
at com.opensymphony.module.sitemesh.factory.BaseFactory.pushDecoratorMapper(BaseFactory.java:117)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadDecoratorMappers(Grails5535Factory.java:235)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadConfig(Grails5535Factory.java:98)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.<init>(Grails5535Factory.java:66)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.init(GrailsPageFilter.java:79)
Truncated. see log file for complete stacktrace
>
<Mar 27, 2012 12:38:55 PM PDT> <Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.codehaus.groovy.gra
ils.web.mapping.filter.UrlMappingsFilter.
java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationConte
xtUtils.java:84)
at org.codehaus.groovy.grails.web.util.WebUtils.lookupHandlerInterceptors(WebUtils.java:97)
at org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter.initFilterBean(UrlMappingsFilter.java:77)
at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:179)
at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:576)
Truncated. see log file for complete stacktrace
>
<Mar 27, 2012 12:38:55 PM PDT> <Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.codehaus.groovy.gra
ils.web.servlet.mvc.GrailsWebRequestFilter.
java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationConte
xtUtils.java:84)
at org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter.initialize(GrailsWebRequestFilter.java:98)
at org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter.initFilterBean(GrailsWebRequestFilter.java:94)
at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:179)
at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:576)
Truncated. see log file for complete stacktrace
>
<Mar 27, 2012 12:38:55 PM PDT> <Error> <HTTP> <BEA-101216> <Servlet: "grails" failed to preload on startup in Web application: "gr
a.war".
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/la
ng/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:159)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:301)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:240)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:299)
Truncated. see log file for complete stacktrace
>
<Mar 27, 2012 12:39:03 PM PDT> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID "1
332877104876" for task "0". Error is: "weblogic.application.ModuleException: [HTTP:101216]Servlet: "grails" failed to preload on s
tartup in Web application: "gra.war".
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/la
ng/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:159)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:301)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:240)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:299)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:250)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
at weblogic.servlet.internal.StubSecurityHelper.initServletInstance(StubSecurityHelper.java:94)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:82)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:74)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:60)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:34)
at weblogic.servlet.internal.ServletStubImpl.initStubLifecycleHelper(ServletStubImpl.java:638)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:579)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1874)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1848)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1738)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2740)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1704)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:781)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:213)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:208)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:70)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:212)
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:111)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:213)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:208)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:70)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:24)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:729)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258)
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:48)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:582)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:148)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:114)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:335)
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(DeploymentReceiverCa
llbackDeliverer.java:195)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallback
Deliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliv
erer.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)
"
weblogic.application.ModuleException: [HTTP:101216]Servlet: "grails" failed to preload on startup in Web application: "gra.war".
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/la
ng/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:159)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:301)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:240)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:299)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:250)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
at weblogic.servlet.internal.StubSecurityHelper.initServletInstance(StubSecurityHelper.java:94)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:82)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:74)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:60)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:34)
at weblogic.servlet.internal.ServletStubImpl.initStubLifecycleHelper(ServletStubImpl.java:638)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:579)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1874)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1848)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1738)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2740)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1704)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:781)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:213)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:208)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:70)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:212)
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:111)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:213)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:208)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:70)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:24)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:729)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258)
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:48)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:582)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:148)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:114)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:335)
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(DeploymentReceiverCa
llbackDeliverer.java:195)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallback
Deliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliv
erer.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)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1706)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:781)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:213)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:208)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
Truncated. see log file for complete stacktrace
Caused By: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/Stri
ng;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:159)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:301)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:240)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:299)
Truncated. see log file for complete stacktrace
>
<Mar 27, 2012 12:39:04 PM PDT> <Error> <Deployer> <BEA-149202> <Encountered an exception while attempting to commit the 1 task for
the application "gra".>
<Mar 27, 2012 12:39:04 PM PDT> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for applicat
ion "gra".>
<Mar 27, 2012 12:39:04 PM PDT> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException: [HTTP:101216]Servlet: "grails" failed to preload on startup in Web application: "gra.war".
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/la
ng/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:159)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:301)
整个跟踪的确很长,但是基本上,正如我所看到的,它看起来像带有Sl4j api的某个问题.不知道是什么原因,因为当我不使用WAR甚至在Tomcat Server v6中部署了WAR的情况下直接运行应用程序时,应用程序运行良好
The Entire Trace is really long but basically as I am seeing it, it looks like some isuue with Sl4j api. Not sure what is the cause since the application runs fine when I do run-app directly without WAR and even with the WAR delpoyed in Tomcat Server v6
预先感谢
推荐答案
SLF4J的Weblogic中捆绑的版本是1.6.1,而grails带有1.5.10
The version bundled in Weblogic of SLF4J is 1.6.1 and grails comes with 1.5.10
如果您正在使用maven,则请参见以下线程: http://forum.springsource .org/showthread.php?124753-Spring-mvc-sample-project-slf4j-problem& p = 407143
If you're using maven then see this thread:http://forum.springsource.org/showthread.php?124753-Spring-mvc-sample-project-slf4j-problem&p=407143
您可以尝试使用PARENT_LAST/CHILD_FIRST类加载器选项,或从grails WAR中删除slf4j wars
You can try using a PARENT_LAST/CHILD_FIRST classloader option or removing the slf4j wars from the grails WAR
Ex了解如何清除战争:
Ex from Grails Deployment page on how to remove Wars:
//Remove logging libs from grails app because they're already supplied by Jboss - BuildConfig.groovy
grails.war.resources = { stagingDir ->
for (name in ['log4j', 'slf4j', 'jcl-over-slf4j', 'jul-to-slf4j']) {
delete {
fileset dir: "$stagingDir/WEB-INF/lib/",
includes: "$name*.jar"
}
}
}
这篇关于部署grails应用程式大战时,weblogic中出现sl4j错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!