0

The following is my context.xml file in the META-INF directory of my project :

<?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" />

But when I try to deploy/run the project netbeans produces the following error :

[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.

Why do I get this error ? I have added the database information in the context.xml.

enter image description here

Suhail Gupta
  • 22,386
  • 64
  • 200
  • 328

1 Answers1

7

In your context.xml, take out the / right before the > in your Context tag and add the end tag after the Resource. Your Resource should be defined within your Context.

<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>

Hope this helps!

Hoogles
  • 96
  • 1
  • 4