读书人

配备JNDI 报错 The reference to enti

发布时间: 2013-04-09 16:45:09 作者: rapoo

配置JNDI 报错 The reference to entity "characterEncoding" must end with the ';' delimiter

<Context path="/bizsample" docBase="E:/行业版/eclipse/workspace/bizsample/WebApp">
<Resource auth="Container"
name="jdbc/bizsample"
type="MySql"
maxActive="3306"
maxIdle="4"
maxWait="10"
username="root"
password="admin"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/test?useUnicode=true;characterEncoding=utf-8" />
</Context>

上边这种配置方式 会报The reference to entity "characterEncoding" must end with the ';' delimiter 这个错误。

这是由xml文件中的编码规则决定要这么变换。

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

<

<

小于号

>

>

大于号

&

&

'

'

单引号

"

"

双引号

正确的方式

<Context path="/bizsample" docBase="E:/行业版/eclipse/workspace/bizsample/WebApp">
<Resource auth="Container"
name="jdbc/bizsample"
type="MySql"
maxActive="3306"
maxIdle="4"
maxWait="10"
username="root"
password="admin"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8" />
</Context>

读书人网 >编程

热点推荐