java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

GitHub | soiff | 1 year ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    编译出错org.xml.sax.SAXParseException; systemId: http://www.springframework.org/schema/mvc/spring-mvc.xsd; lineNumber: 24; columnNumber: 20; cos-all-limited.1.2

    GitHub | 1 year ago | soiff
    java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

    Root Cause Analysis

    1. java.lang.IllegalStateException

      BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

      at org.apache.catalina.mbeans.MBeanFactory.createStandardContext()
    2. Embedded GlassFish Web
      MBeanFactory.createStandardContext
      1. org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:618)
      1 frame
    3. Spring Context
      AbstractRefreshableApplicationContext.getBeanFactory
      1. org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:170)
      1 frame
    4. Embedded GlassFish Web
      MBeanFactory.createStandardContext
      1. org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:565)
      1 frame
    5. Spring Context
      AbstractApplicationContext.destroyBeans
      1. org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:908)
      1 frame
    6. Java RT
      NativeMethodAccessorImpl.invoke0
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      1 frame
    7. Spring Context
      AbstractApplicationContext.doClose
      1. org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:884)
      1 frame
    8. Java RT
      NativeMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      1 frame
    9. Spring Context
      AbstractApplicationContext.close
      1. org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:836)
      1 frame
    10. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      1 frame
    11. Spring
      ContextLoader.closeWebApplicationContext
      1. org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:579)
      1 frame
    12. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Method.java:606)
      1 frame
    13. Spring
      ContextLoaderListener.contextDestroyed
      1. org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
      1 frame
    14. Embedded GlassFish Web
      BaseModelMBean.invoke
      1. org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
      1 frame
    15. Java RT
      DefaultMBeanServerInterceptor.invoke
      1. com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
      1 frame
    16. com.baidu.dsp
      ContextListener.contextDestroyed
      1. com.baidu.dsp.common.listener.ContextListener.contextDestroyed(ContextListener.java:16)
      1 frame
    17. Glassfish Core
      StandardContext.listenerStop
      1. org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5063)
      1 frame
    18. Java RT
      JmxMBeanServer.invoke
      1. com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
      1 frame
    19. Glassfish Core
      StandardContext.stopInternal
      1. org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5723)
      1 frame
    20. Java RT
      RMIConnectionImpl.doOperation
      1. javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487)
      1 frame
    21. Glassfish Core
      LifecycleBase.stop
      1. org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
      1 frame
    22. Java RT
      RMIConnectionImpl.access$300
      1. javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
      1 frame
    23. Glassfish Core
      LifecycleBase.start
      1. org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
      1 frame
    24. Java RT
      RMIConnectionImpl$PrivilegedOperation.run
      1. javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
      1 frame
    25. Glassfish Core
      ContainerBase.addChildInternal
      1. org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
      1 frame
    26. Java RT
      RMIConnectionImpl.doPrivilegedOperation
      1. javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420)
      1 frame
    27. Glassfish Core
      ContainerBase.addChild
      1. org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
      1 frame
    28. Java RT
      RMIConnectionImpl.invoke
      1. javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848)
      1 frame
    29. Glassfish Core
      StandardHost.addChild
      1. org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
      1 frame
    30. Java RT
      NativeMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      2 frames
    31. Glassfish Core
      HostConfig.manageApp
      1. org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1779)
      1 frame
    32. Java RT
      Transport$1.run
      1. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      2. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      3. java.lang.reflect.Method.invoke(Method.java:606)
      4. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      5. sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
      6. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      7. sun.rmi.transport.Transport$1.run(Transport.java:177)
      8. java.lang.reflect.Method.invoke(Method.java:606)
      9. sun.rmi.transport.Transport$1.run(Transport.java:174)
      9 frames
    33. Embedded GlassFish Web
      BaseModelMBean.invoke
      1. org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
      1 frame
    34. Java RT
      TCPTransport.handleMessages
      1. java.security.AccessController.doPrivileged(Native Method)
      2. com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
      3. sun.rmi.transport.Transport.serviceCall(Transport.java:173)
      4. com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
      5. sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
      5 frames
    35. Embedded GlassFish Web
      MBeanFactory.createStandardContext
      1. org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:618)
      1 frame
    36. Java RT
      TCPTransport$ConnectionHandler.run0
      1. sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
      1 frame
    37. Embedded GlassFish Web
      MBeanFactory.createStandardContext
      1. org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:565)
      1 frame
    38. Java RT
      Method.invoke
      1. sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
      2. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      3. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      4. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      5. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      6. java.lang.Thread.run(Thread.java:745)
      7. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      8. java.lang.reflect.Method.invoke(Method.java:606)
      8 frames
    39. Embedded GlassFish Web
      BaseModelMBean.invoke
      1. org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
      1 frame
    40. Java RT
      Thread.run
      1. com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
      2. com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
      3. javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487)
      4. javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
      5. javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
      6. javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420)
      7. javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848)
      8. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      9. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      10. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      11. java.lang.reflect.Method.invoke(Method.java:606)
      12. sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
      13. sun.rmi.transport.Transport$1.run(Transport.java:177)
      14. sun.rmi.transport.Transport$1.run(Transport.java:174)
      15. java.security.AccessController.doPrivileged(Native Method)
      16. sun.rmi.transport.Transport.serviceCall(Transport.java:173)
      17. sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
      18. sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
      19. sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
      20. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      21. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      22. java.lang.Thread.run(Thread.java:745)
      22 frames