java关于报错:The reference to entity "characterEncoding" must end with the ';' delimiter.

Java 解析XML文件错误。

错误信息提示代码类似如下:

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

ontext initialization failed
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 9 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The reference to entity "characterEncoding" must end with the ';' delimiter.

纠错结果:

在配置一个访问数据库的Url时,第一次设置的内容如下:

jdbc:mysql://localhost:3306/photo?useUnicode=true&characterEncoding=UTF-8,注意中间那个“&”,在xml中这个是读不出的,正确写法将“&”转义“&”:

jdbc:mysql://localhost:3306/photo?useUnicode=true&characterEncoding=UTF-8

分析:

有时候在使用xml作为配置文件的时候,应该要使用xml的编码规则来进行适当的设置。

下面给出xml中一些特殊符号的编码转换:

 < 小于号
> > 大于号
& & and字符
' ' 单引号
" " 双引号

---------------------
作者:杨四郎2018
来源:CSDN
原文:https://blog.csdn.net/yang5726685/article/details/56015938
版权声明:本文为博主原创文章,转载请附上博文链接!

java报错:The reference to entity "characterEncoding" must end with the ';' delimiter.的更多相关文章

  1. 在java的xml文件配置数据库URL地址时提示The reference to entity "characterEncoding" must end with the ';' delimiter.错误信息

    配置数据库的URL<property name="url" value="jdbc:mysql://127.0.0.1:3306/micro_message&quo ...

  2. The reference to entity "characterEncoding" must end with the ';' delimiter

    数据源配置时加上编码转换格式后出问题了: The reference to entity "characterEncoding" must end with the ';' del ...

  3. xml文件中配置JDBC源遇到问题 : The reference to entity "characterEncoding" must end with the ';' delimiter

    数据源配置时加上编码转换格式后出问题了: The reference to entity"characterEncoding" must end with the ';' deli ...

  4. The reference to entity "characterEncoding" must end with the ';' delimiter (Mybatis + Mysql)

    数据源配置时加上编码转换格式后出问题了: The reference to entity "characterEncoding" must end with the ';' del ...

  5. 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 Sourc ...

  6. 项目配置 xml文件时 报错提示(The reference to entity "useSSL" must end with the ';' delimiter.)

    这次在配置xml文件时,出现错误提示( The reference to entity “useSSL” must end with the ‘;’ delimiter.) 报错行为 <prop ...

  7. 配置c3p0-config.xml数据库连接池,jdbcurl配置项报错Type The reference to entity "useUnicode" must end with the ';' delimiter.

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xml> <c3p0-confi ...

  8. java 报错及解决

    java文件编译报错:error: unmappable character for encoding ASCII 解决: 编译时:javac -encoding utf-8 TestJava.jav ...

  9. [java报错]Could not instantiate listener XXXXXX

    写在开头的话: 兜兜转转,辞去了深圳的工作,回到了武汉,从事的居然一度是我最不想学的语言-java,曾经以为自己并不会java,但是上手之后,发现语言都是相通的,自己一度排斥学习java真的是不能再傻 ...

随机推荐

  1. C#中字符串的操作大全

    一.C#中字符串的建立过程 例如定义变量 strT="Welcome to "; strT+="www.cuit.edu.cn"; 程序首先创建一个System ...

  2. 基于.net core 3 和 Orleans 3 的 开发框架:Phenix Framework 7

    Phenix Framework 7 for .net core 3 + Orleans 3 发布地址:https://github.com/phenixiii/Phenix.NET7 2019052 ...

  3. 1-Consul系列文章

    使用Consul做服务发现的若干姿势 Consul的反熵 [Consul]Consul架构-简介

  4. saltstack的简单搭建

    环境; centos 7     192.168.10.10    master centos 7     192.168.10.129  minion 1.为了方便关闭防火墙 [root@local ...

  5. mybatis源码/mybatis执行流程源码解析

    https://www.cnblogs.com/cxiaocai/tag/%E9%9D%A2%E8%AF%95%E9%A2%98/public SqlSession session; public S ...

  6. 【开发笔记】- Grails框架定义一个不是数据库字段得属性

    实体类 class Book{ String name String author // myfiled 我不想他在数据库中生成book表的字段 String myfield } 添加声明 class ...

  7. 操作mysql数据库的一些命名

    一.打开数据库 1.1.打开命令行输入:mysql -u root -p 1.2.root是本地数据库的用户名,然后输入数据库的密码进入. 二.数据库操作 2.1.创建一个数据库:create dat ...

  8. kingbase常用语句

    1. 查询数据库名 # select * from SYS_DATABASE; 2. 查询模式名 # select * from SYS_NAMESPACE; 3. 查询表空间 # select * ...

  9. springboot入门介绍

    1. SpringBoot学习之@SpringBootApplication注解 下面是我们经常见到SpringBoot启动类代码: @SpringBootApplicationpublic clas ...

  10. Reactive-MongoDB 异步 Java Driver 解读

    一.关于 异步驱动 从3.0 版本开始,MongoDB 开始提供异步方式的驱动(Java Async Driver),这为应用提供了一种更高性能的选择.但实质上,使用同步驱动(Java Sync Dr ...