1. 程式人生 > >tomacat 啟動時報錯 : BeanFactory not initialized or already closed

tomacat 啟動時報錯 : BeanFactory not initialized or already closed

tomcat日誌資訊

Dec 07, 2017 6:01:53 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Dec 07, 2017 6:01:53 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Dec 07, 2017 6:02:16 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to
listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 18 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 18
; columnNumber: 74; cvc-elt.1: Cannot find the declaration of element 'beans'. at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335
) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:540) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5118) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: org.xml.sax.SAXParseException; lineNumber: 18; columnNumber: 74; cvc-elt.1: Cannot find the declaration of element 'beans'. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1900) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:740) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:613) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3132) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:852) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:428) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) ... 26 more Dec 07, 2017 6:02:16 PM org.apache.catalina.core.ApplicationContext log INFO: Closing Spring root WebApplicationContext Dec 07, 2017 6:02:16 PM org.apache.catalina.core.StandardContext listenerStop SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:170) at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:921) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:895) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:841) at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:581) at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:116) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5165) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5829) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:221) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:149) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Dec 07, 2017 6:02:17 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() Dec 07, 2017 6:02:17 PM org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized() Dec 07, 2017 6:02:17 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', '[email protected]350c2302')
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 18 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 18; columnNumber: 74; cvc-elt.1: Cannot find the declaration of element 'beans'.

說明標頭檔案的資訊有錯,導致不能啟動spring 容器
專案中匯入的spring beans 和spring context的jar包版本是4.0.5 而applicationContext.xml中的名稱空間的版本卻是4.2
所以把jar包換成4.2.5的就可以了

相關推薦

tomacat 啟動時報 BeanFactory not initialized or already closed

tomcat日誌資訊 Dec 07, 2017 6:01:53 PM org.apache.catalina.core.ApplicationContext log INFO: No Spring WebApplicationInitializer typ

【報BeanFactory not initialized or already closed

在網上查詢很久,很多人說是因為 錯誤寫法:ApplicationContext ctx = new ClassPathXmlApplicationContext(); 時,沒有指定配置檔案,Spring例項化BeanFactory的時候是預設到classPath下

eclipse啟動tomcat時BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

bean nfa 配置 .com 分享 如果 call 啟動tomcat 配置文件 大致是核心配置文件的問題。 如果配置沒錯,看看符號等是不是完整。或者是路徑的包是不是多了/ eclipse啟動tomcat時BeanFactory not initialized o

BeanFactory not initialized or already closed - call 'refresh' before accessing beans解決辦法

nco spring實例 org tro all 指定 ctr bsp close 今天在寫Spring程序時遇到了一個很常見的錯誤,而我以前好像一直沒碰到過,今天才見到這個錯誤,經過研究解決了這個錯誤,犯這個錯誤真是不應該啊。 log4j:WARN No appen

異常BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the Appl

異常:BeanFactory not initialized or already closed - call ‘refresh’ before accessing beans via the ApplicationContext 網上查了很多解決的方法,這裡我說我的失誤導致的這個異

BeanFactory not initialized or already closed

先看一下是不是spring的xml檔案頭部沒有配置好 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xml

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

在做Spring整合Struts2的時候,啟動專案,就報瞭如下的錯誤 Exception sending context initialized event to listener instance of class org.springframework.web.context.Conte

maven專案-載入不到spring檔案,BeanFactory not initialized or already closed

嚴重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener

TOMCAT啟動時報the CATALINA_HOME environment variable is not defined correctly

步驟一:新增CATALINA_HOME環境變數,變數值同TOMCAT_HOME 步驟二:檢查CATALINA_HOME,JAVA_HOME,TOMCAT_HOME的變數值後邊有沒有分號(;)有的話刪除 此時啟動TOMCAT應該會成功,但在瀏覽器位址列中輸入http://localhost:8

kafka啟動時報java.net.UnknownHostException: Name or service not known

今天在用下面的指令啟動kafa的時候報錯了: # bin/kafka-server-start.sh config/server.properties & 錯誤資訊如下: [2018-04-11 16:27:31,185] ERROR [KafkaServer

Spacemacs啟動時報Symbol's funciton definition is void: cl-struct-define

space 不兼容 文件 編譯 mac 運行 void style truct 解決方法很簡單:刪除.emacs.d/elpa/ 目錄下面所有的*.elc文件。 原因:elc是el文件的預編譯文件,類似py文件的pyc文件,是一種二進制文件,不同版本的emacs是不兼容的。

Maven項目Eclipse啟動時報 java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener

otf exce exe maven com apply ges 選中項 apache Eclipse中啟動Maven項目時報如下錯誤: 嚴重: Error configuring application listener of class org.springfra

java 連接 redis集群時報Could not get a resource from the pool

rom idt log 圖片 pool 本機ip redis style exce 由於弄這個的時候浪費了太多的時間,所以才記錄下這個錯,給大夥參考下 檢查了一下,配置啥的都沒問題的,但在redis集群機器上就可以,錯誤如下: Exception in thread "

eclipse啟動Could not create the java virtual machine

報錯 解壓 java 開發 升級 最新 分享 src info 用maven、springboot開發時,安裝了當時最新版的eclipse(3.5.5)。eclipse解壓版的非常方便,想先安裝了看看。暫時沒有升級其他軟件。 打開的時候報錯: 原因其實就是還木有升級新版

mysql啟動時報Starting MySQL... ERROR! The server quit without updating PID file (/opt/mysql/data/mysql.pid)

.com quit blog erro selinux 打開 archive out com mysql啟動報錯Starting MySQL... ERROR! The server quit without updating PID file (/opt/mysql/da

win10 ent安裝Django時報Could not install packages due to an EnvironmentError: [WinError 5] 拒絕訪問。

- Could not install packages due to an EnvironmentError: [WinError 5] 拒絕訪問。: 'c:\\program files\\python37\\Lib\\site-packages\\pytz'Consider using

Hive啟動時報cannot access ....spark/lib/spark-assembly-*.jar: No such file or directoryog解決

在安裝spark後,通過bin/hive 啟動hive時報錯: ls:cannot access /export/servers/spark/lib/spark-assembly-*.jar: No such file or directoryog 原因分析:

tomcat啟動時報Error creating bean with name 'transactionManager' defined in class path resource

最近寫了一個專案,部署到服務上的時候遇到一個奇葩的問題,一般本地起專案是用jetty玩的,jetty完全正常當部署到tomcat報錯了,找了2天才解決問題,這兩天tomcat問題就像 滿漢全席一樣不重樣。 報錯原文:Error creating bean with name 'transacti

CentOS6.x中vmware workstation 虛擬機器啟動Could not open /dev/vmmon

最初安裝報錯,但是介面可以開啟,可以正常安裝,但是安裝過後,啟動報錯 Gtk-Message: Failed to load module "canberra-gtk-module": libcanberra-gtk-module.so:cannot open sh

tomcat啟動Could not publish server configuration for Tomcat v7.0 Server at localhost。

我用的是tomcat7.0.82. tomcat報錯,無法啟動。 **報錯資訊:**Could not publish server configuration for Tomcat v7.0 server at localhost. 和 Server Tomcat v7.0 Ser