博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。
阅读量:6813 次
发布时间:2019-06-26

本文共 12862 字,大约阅读时间需要 42 分钟。

今天整合项目,报如下错误:

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:application.properties]Offending resource: class path resource [application-client.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 1 in XML document from class path resource [application.properties] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:250)at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:201)at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:186)at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:143)at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:110)at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508)at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)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:537)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:452)at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)at java.util.concurrent.FutureTask.run(FutureTask.java:266)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)at java.lang.Thread.run(Thread.java:745)Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 1 in XML document from class path resource [application.properties] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。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.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:244)... 28 moreCaused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1437)at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:999)at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:118)at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)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)... 33 more四月 08, 2016 1:04:24 下午 org.apache.catalina.core.StandardContext startInternal严重: Error listenerStart四月 08, 2016 1:04:24 下午 org.apache.catalina.core.StandardContext startInternal严重: Context [/client] startup failed due to previous errors四月 08, 2016 1:04:24 下午 org.apache.catalina.core.ApplicationContext log信息: Closing Spring root WebApplicationContext2016-04-08 13:04:24,238 WARN (org.springframework.web.context.support.XmlWebApplicationContext:872) - Exception thrown from ApplicationListener handling ContextClosedEventjava.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Fri Apr 08 13:04:23 CST 2016]; root of context hierarchyat org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:344)at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:869)at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:836)at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:579)at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4980)at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5626)at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)at java.util.concurrent.FutureTask.run(FutureTask.java:266)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)at java.lang.Thread.run(Thread.java:745)2016-04-08 13:04:24,240 WARN (org.springframework.web.context.support.XmlWebApplicationContext:880) - Exception thrown from LifecycleProcessor on context closejava.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Fri Apr 08 13:04:23 CST 2016]; root of context hierarchyat org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:357)at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:877)at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:836)at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:579)at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4980)at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5626)at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)at java.util.concurrent.FutureTask.run(FutureTask.java:266)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)at java.lang.Thread.run(Thread.java:745)四月 08, 2016 1:04:24 下午 org.apache.catalina.core.StandardContext listenerStop严重: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListenerjava.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContextat org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:170)at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:908)at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:884)at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:836)at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:579)at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4980)at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5626)at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)at java.util.concurrent.FutureTask.run(FutureTask.java:266)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)at java.lang.Thread.run(Thread.java:745)

 

报这个错误都是在xml中这样引用 properties文件的:<import resource="classpath:application.properties"/>

 改成  <context:property-placeholder location="classpath:application.properties" />就好了

转载于:https://www.cnblogs.com/kong-lin/p/5367630.html

你可能感兴趣的文章
sqlplus无密码登录TNS协议适配器错误
查看>>
2013=726 整合,优化,利用自身资源。 让自己的时间更有意义,最大化利用
查看>>
24、List三个子类的特点
查看>>
123
查看>>
常用的排序算法的时间复杂度和空间复杂度
查看>>
Ubuntu系统下面软件安装更新命令
查看>>
spring cloud:HystrixDashboard
查看>>
bootstrap与Select2使用小结
查看>>
找不到或无法加载主类
查看>>
iOS通过ASIHTTPRequest提交JSON数据
查看>>
2017 ZSTU寒假排位赛 #5
查看>>
如何查看gpio 使用状态,以及被那些模块request
查看>>
MyBatis-SELECT基本查询
查看>>
通配符&&选择器
查看>>
2013与2014之流水
查看>>
call Kernelized Correlation Filters Tracker(Matab) in Qt(c++)
查看>>
CodeForces 292D Connected Components (并查集+YY)
查看>>
函数式编程
查看>>
为什么要有mmu
查看>>
1018. Binary Prefix Divisible By 5可被 5 整除的二进制前缀
查看>>