Caused by: org.xml.sax.SAXParseException: The reference to entity "characterEncoding" must end with the ';' delimiter.

at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanAttribute(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
    at org.springframework.orm.jpa.persistenceunit.PersistenceUnitReader.validateResource(PersistenceUnitReader.Java:187)
    at org.springframework.orm.jpa.persistenceunit.PersistenceUnitReader.readPersistenceUnitInfos(PersistenceUnitReader.java:138)
    ... 48 more

JPA persistence xml 中报错的写法:

<property name="hibernate.connection.url" value="jdbc:MySQL://localhost:3306/test?useUnicode=true&characterEncoding=utf-8" />

正确的写法:

<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/test?useUnicode=true&amp;characterEncoding=utf-8" />

在xml文件中有以下几类字符要进行转义替换:


&lt;


<


小于号


&gt;


>


大于号


&amp;


&



&apos;



单引号


&quot;

Caused by: org.xml.sax.SAXParseException: The reference to entity "characterEncoding" must end with the ';' delimiter.

时间: 2024-10-05 15:23:25

Caused by: org.xml.sax.SAXParseException: The reference to entity "characterEncoding" must end with the ';' delimiter.的相关文章

Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in

1.错误描述 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 1 in XML document from file [E:\Ecl

Caused by: org.xml.sax.SAXParseException; lineNumber: 30; columnNumber: 84; 对实体 &quot;characterEncoding&quot;

1.错误描述 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 30 in XML document from class path

Caused by: org.xml.sax.SAXParseException; lineNumber: 28; columnNumber: 81;

1.错误描述 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 28 in XML document from class path

Caused by: org.xml.sax.SAXParseException: The content of elements must consist of well-formed charac

启动tomcat后,console报错如下: Caused by: org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup. 由于这种错误都犯了几次,现在把问题记录下来. 第一种产生的原因是:sql中的大于号(>)或(<)小于号没有进行转义. XML只有5个转义符:<,>,&,",?;的转义字符分别如下:

Caused by: org.xml.sax.SAXParseException: 文件提前结束。

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.2019-05-11 12:24:20.657 ERROR 59648 --- [ main] o.s.boot.SpringApplication : Application startup failed org.springframework.beans

Caused by: org.xml.sax.SAXParseException: 外部 DTD: 无法读取外部 DTD &#39;mybatis-generator-config_1_0.dtd&#39;

1.环境: JDK 1.8 IntelliJ IDEA 2019.3.2 (Community Edition) Build #IC-193.6015.39, built on January 21, 2020 Runtime version: 11.0.5+10-b520.30 amd64 2.现象: 添加 mybatis 的 generatorConfig.xml 后报错 Caused by: org.apache.ibatis.builder.BuilderException: Error

在配置XML时报的The reference to entity &quot;dataSource&quot; must end with the &#39;;&#39; delimiter错误

<?xml version="1.0" encoding="UTF-8"?> <ECharts> <element>http://localhost:8080/EChartDynamic/DEcharts_bar1?flag=teacher_sex&dataSource=UTADB</element> <element>http://localhost:8080/EChartDynamic/DEch

The reference to entity &quot;characterEncoding&quot; must end with the &#39;;&#39; delimiter.

<property name="url" value="jdbc:mysql://localhost:3306/ceshi?useUnicode=true&characterEncoding=utf8" /> 一个正常的MySQL配置却一直报错: The reference to entity "characterEncoding" must end with the ';' delimiter. 逐步深究出在xml配置文件中

报错The reference to entity &quot;characterEncoding&quot; must end with the &#39;;&#39; delimiter

The reference to entity "characterEncoding" must end with the ';' delimiter 数据源配置时加上编码转换格式后出问题了: The reference to entity "characterEncoding" must end with the ';' delimiter 这个错误就是 context.xml中设置数据源链接URL的问题 <context-param> <par