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

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
云数据库 RDS MySQL Serverless,价值2615元额度,1个月
简介:

  在实现Java数据池时,进行配置数据源时出现了该报错信息。报错信息出现在 context.xml 中,原语句是:

<Context>    

   <Resource name="jdbc/onlinefriend"

    auth="Container" 

    type="javax.sql.DataSource"         

     driverClassName="com.mysql.jdbc.Driver"    

     url="jdbc:mysql://127.0.0.1:3306/onlinefriend?useUnicode=true&characterEncoding=utf-8"

     username="root"  

     password="root" 

     maxActive="100"  

     maxIdle="30"  

     maxWait="10000"    />    

 </Context>  


这是由于xml的编码问题导致,小小的修改后问题解决:

<Context>    

   <Resource name="jdbc/onlinefriend"

    auth="Container" 

    type="javax.sql.DataSource"         

     driverClassName="com.mysql.jdbc.Driver"    

     url="jdbc:mysql://127.0.0.1:3306/onlinefriend?useUnicode=true&amp;characterEncoding=utf-8"

     username="root"  

     password="root" 

     maxActive="100"  

     maxIdle="30"  

     maxWait="10000"    />    

 </Context>  


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

&lt; < 小于
&gt; > 大于
&amp; &
&apos; ' 单引号
&quot; " 双引号


本文转自 pangfc 51CTO博客,原文链接:http://blog.51cto.com/983836259/1697596,如需转载请自行联系原作者

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
4月前
|
SQL IDE Java
hibernate5 Cannot create TypedQuery for query with more than one return using requested result type
hibernate5 Cannot create TypedQuery for query with more than one return using requested result type
25 0
|
6月前
SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘thinkphp.test‘ don‘t exsit
SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘thinkphp.test‘ don‘t exsit
111 0
|
SQL Java 数据库连接
mybatis 批量插入 Column count doesn‘t match value count at row 1
mybatis 批量插入 Column count doesn‘t match value count at row 1
122 0
SAP WM Movement Type 里的‘Ref.Stor.Type Search’字段用法初探
SAP WM Movement Type 里的‘Ref.Stor.Type Search’字段用法初探
SAP WM Movement Type 里的‘Ref.Stor.Type Search’字段用法初探
How to add extension field to report
How to add extension field to report
107 0
|
XML Java 数据库连接
Open quote is expected for attribute "{1}" associated with an element type "id".
Open quote is expected for attribute "{1}" associated with an element type "id".
154 0
Open quote is expected for attribute "{1}" associated with an element type "id".
|
SQL 存储 Oracle
Implementation of Global Temp Table
作者| 曾文旌阿里云数据库高级技术专家
333 0
Implementation of Global Temp Table
|
Java 数据格式 XML
JakartaEE Exception: Invalid bound statement (not found): com.mazaiting.blog.dao.UserDao.selectUs...
异常 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.
1186 0