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. Canon MF113W激光打印机双面打印方法

    系统:macOS 10.14.3 打印机:Canon MF113W 黑白激光打印机(不支持自动双面打印) 方法: 1)文件->打印->纸张处理->仅奇数页->倒序->打印 ...

  2. 学习CSS Grid布局

    一. 重要术语: CSS Grid(网格) 布局(又称为 "Grid(网格)" ),是一个二维的基于网格的布局系统,它的目标是完全改变我们基于网格的用户界面的布局方式. FlexB ...

  3. JAVA集合框架的特点及实现原理简介

    1.集合框架总体架构 集合大致分为Set.List.Queue.Map四种体系,其中List,Set,Queue继承自Collection接口,Map为独立接口 Set的实现类有:HashSet,Li ...

  4. 企业安全之APT攻击防护

    现在针对企业APT[1]攻击越来越多了,企业安全也受到了严重的威胁,由于APT攻击比较隐匿的特性[2],攻击并不能被检测到,所以往往可以在企业内部网络潜伏很长时间. APT的攻击方式多种多样,导致企业 ...

  5. Java 关于函数式接口与Lambda表达式之间的关系

    java是一种面向对象的语言,java中的一切都是对象,即数组,每个类创建的实例也是对象.在java中定义的函数或方法不可能完全独立,也不能将方法函数作为参数或返回值给实例. 在java7及以前,我们 ...

  6. 下载win10系统

    有时候想重装系统但总找不到下载的地方,今天记录一下.nsdn我告诉你,这里有许多软件下载 网站URL:https://msdn.itellyou.cn/ 我想下载一个Windows10 磁力地址 ed ...

  7. 源码升级SUSE openssh

    1.check old opensslrpm -q opensslopenssl versionwhich opensslwhereis opensslls /etc/ssl 2.backup old ...

  8. c#执行sql超时

    超时分为多种,SqlConnection有超时选项, SqlDataAdapter也有超时选项设置如下: SqlConnection:就用链接字符串给予的Timeout设置就行单位秒: SqlData ...

  9. springboot 登录实现源代码解析

    springboot 可以使用springsecurity 作为安全框架,我们可以使用springsecurity 实现安全登录. springsecurity 是使用一系列的过滤器来实现安全的. 实 ...

  10. Jmeter 使用自定义变量

    有些情况下比如发起测试时URL的主机名和端口需要在采样器中出现多次,这样就有个问题,当测试的主机更改时, 我们需要修改主机名称,这时就需要修改多个地方,如果多的情况会有遗漏.如果我们在配置脚本的时候, ...