在 项目工程的 META-INF 目录下 建立一个 context 的配置文件
<Context> <WatchedResource>WEB-INF/web.xml</WatchedResource> <Resource name="jdbc/mysqlds" auth="Container" type="javax.sql.DataSource" maxActive="200" maxIdel="30" maxWait="10000" username="root" password="root" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://192.168.1.36:3306/test?useUnicode=true&characterEncoding=utf-8" /> </Context>
然后启动tomcat的时候会报如下错误
The reference to entity "useUnicode" must end with the ';' delimiter.
解决办法 如下
将
useUnicode=true&characterEncoding=utf-8
改成
useUnicode=true&characterEncoding=utf-8
也就是 & 改成 &
转自:
http://forums.atlassian.com/message.jspa?messageID=257250776
Use & instead of &. This will help XML parser to ignore &.