【问题标题】:Error : The markup in the document following the root element must be well-formed [duplicate]错误:根元素之后的文档中的标记必须格式正确[重复]
【发布时间】:2012-07-20 18:26:08
【问题描述】:

以下是我的项目META-INF目录下的context.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/poll"/>

<Resource name="jdbc/PollDatasource" auth="Container" type="javax.sql.DataSource"
 driverClassName="org.apache.derby.jdbc.ClientDriver"
 url="jdbc:derby://localhost:1527/poll database;create=true"
 username="suhail" password="suhail"
 maxActive="20" maxIdle="10" maxWait="-1" />

但是当我尝试部署/运行项目时,netbeans 会产生以下错误:

[Fatal Error] :4:2: The markup in the document following the root element must be 
well-formed.
W:\UnderTest\NetbeansCurrent\poll\nbproject\build-impl.xml:721: Deployment error: 
Tomcat configuration file 
W:\UnderTest\NetbeansCurrent\poll\web\META-INF\context.xml seems to be broken.
Please make sure it is parseable and valid.
See the server log for details.

为什么会出现此错误?我已经在context.xml中添加了数据库信息。

【问题讨论】:

    标签: java jakarta-ee tomcat context.xml meta-inf


    【解决方案1】:

    在您的 context.xml 中,取出 Context 标签中 > 之前的 / 并在 Resource 之后添加结束标签。您的资源应定义在您的上下文中。

    <Context antiJARLocking="true" path="/poll" >
    
        <Resource name="jdbc/PollDatasource" auth="Container" type="javax.sql.DataSource"
         driverClassName="org.apache.derby.jdbc.ClientDriver"
         url="jdbc:derby://localhost:1527/poll database;create=true"
         username="suhail" password="suhail"
         maxActive="20" maxIdle="10" maxWait="-1" />
    
    </Context>
    

    希望这会有所帮助!

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多