java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?

ZK-Tracker | rdgrimes | 5 years ago
  1. 0

    I typically like to deploy my dependencies (jars) to the endorsed directory of Tomcat so as to reduce the size of deployed project wars. However, because the zkspring jars wire in their own listeners, via metainfo/zk/config.xml, this creates a problem. Specifically, non-Spring projects still try to wire up the Spring CoreWebAppInit, SecurityWebAppInit and WebflowWebAppInit listeners. Since I am not declaring any listeners in my project's web.xml or zk.xml, I can only assume that it is inferring that my non-Sprng project must wire up the Spring listeners because they are declared at the zkspring jar level. This basically is forcing me to remove the zkspring jars from the container's endorsed directory and deploy them with each and ever Spring project. I believe the listeners should be wired exclusively at the project level within its web.xml file. This makes it so we can deploy frequently commonly used jars to the container without having to bloat the size of each war deployed. The error I get at when trying to deploy a non-Spring project to Tomcat, which has the zkspring jars, is: [code] Apr 13, 2012 4:22:05 PM org.zkoss.zk.ui.util.Configuration invokeWebAppInits:729 SEVERE: Failed to invoke class org.zkoss.spring.init.SecurityWebAppInit java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:86) at org.zkoss.spring.init.SecurityWebAppInit.init(SecurityWebAppInit.java:46) at org.zkoss.zk.ui.util.Configuration.invokeWebAppInits(Configuration.java:727) at org.zkoss.zk.ui.impl.AbstractWebApp.init(AbstractWebApp.java:202) at org.zkoss.zk.ui.http.SimpleWebApp.init(SimpleWebApp.java:58) at org.zkoss.zk.ui.http.WebManager.<init>(WebManager.java:224) at org.zkoss.zk.ui.http.DHtmlLayoutServlet.init(DHtmlLayoutServlet.java:102) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1206) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4734) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065) at org.apache.catalina.core.StandardHost.start(StandardHost.java:840) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) [/code]

    ZK-Tracker | 5 years ago | rdgrimes
    java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
  2. 0

    I typically like to deploy my dependencies (jars) to the endorsed directory of Tomcat so as to reduce the size of deployed project wars. However, because the zkspring jars wire in their own listeners, via metainfo/zk/config.xml, this creates a problem. Specifically, non-Spring projects still try to wire up the Spring CoreWebAppInit, SecurityWebAppInit and WebflowWebAppInit listeners. Since I am not declaring any listeners in my project's web.xml or zk.xml, I can only assume that it is inferring that my non-Sprng project must wire up the Spring listeners because they are declared at the zkspring jar level. This basically is forcing me to remove the zkspring jars from the container's endorsed directory and deploy them with each and ever Spring project. I believe the listeners should be wired exclusively at the project level within its web.xml file. This makes it so we can deploy frequently commonly used jars to the container without having to bloat the size of each war deployed. The error I get at when trying to deploy a non-Spring project to Tomcat, which has the zkspring jars, is: [code] Apr 13, 2012 4:22:05 PM org.zkoss.zk.ui.util.Configuration invokeWebAppInits:729 SEVERE: Failed to invoke class org.zkoss.spring.init.SecurityWebAppInit java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:86) at org.zkoss.spring.init.SecurityWebAppInit.init(SecurityWebAppInit.java:46) at org.zkoss.zk.ui.util.Configuration.invokeWebAppInits(Configuration.java:727) at org.zkoss.zk.ui.impl.AbstractWebApp.init(AbstractWebApp.java:202) at org.zkoss.zk.ui.http.SimpleWebApp.init(SimpleWebApp.java:58) at org.zkoss.zk.ui.http.WebManager.<init>(WebManager.java:224) at org.zkoss.zk.ui.http.DHtmlLayoutServlet.init(DHtmlLayoutServlet.java:102) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1206) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4734) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065) at org.apache.catalina.core.StandardHost.start(StandardHost.java:840) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) [/code]

    ZK-Tracker | 5 years ago | rdgrimes
    java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
  3. 0

    grails 2.3 spock integration test No WebApplicationContext found error

    Stack Overflow | 3 years ago | wildleaf
    java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Injecting dependency in ServletContextListener

    Stack Overflow | 3 years ago | Kaliyug Antagonist
    java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
  6. 0

    No WebApplicationContext found: no ContextLoaderListener registered?a

    Stack Overflow | 3 years ago | user3529381
    java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?

  1. mortalman7 1 times, last 4 months ago
4 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalStateException

    No WebApplicationContext found: no ContextLoaderListener registered?

    at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext()
  2. Spring
    WebApplicationContextUtils.getRequiredWebApplicationContext
    1. org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:86)
    1 frame
  3. org.zkoss.spring
    SecurityWebAppInit.init
    1. org.zkoss.spring.init.SecurityWebAppInit.init(SecurityWebAppInit.java:46)
    1 frame
  4. ZK Kernel
    DHtmlLayoutServlet.init
    1. org.zkoss.zk.ui.util.Configuration.invokeWebAppInits(Configuration.java:727)
    2. org.zkoss.zk.ui.impl.AbstractWebApp.init(AbstractWebApp.java:202)
    3. org.zkoss.zk.ui.http.SimpleWebApp.init(SimpleWebApp.java:58)
    4. org.zkoss.zk.ui.http.WebManager.<init>(WebManager.java:224)
    5. org.zkoss.zk.ui.http.DHtmlLayoutServlet.init(DHtmlLayoutServlet.java:102)
    5 frames
  5. JavaServlet
    GenericServlet.init
    1. javax.servlet.GenericServlet.init(GenericServlet.java:212)
    1 frame
  6. Glassfish Core
    Catalina.start
    1. org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1206)
    2. org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026)
    3. org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421)
    4. org.apache.catalina.core.StandardContext.start(StandardContext.java:4734)
    5. org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
    6. org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
    7. org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
    8. org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
    9. org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
    10. org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
    11. org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
    12. org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
    13. org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
    14. org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
    15. org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    16. org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    17. org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    18. org.apache.catalina.core.StandardService.start(StandardService.java:525)
    19. org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    20. org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    20 frames
  7. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    4. java.lang.reflect.Method.invoke(Method.java:597)
    4 frames
  8. Glassfish Core
    Bootstrap.main
    1. org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    2. org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    2 frames