I recently was working on a Spring MVC startup project sample where I used maven built tool. When I run my server using jetty I got this processing instruction error and I found that my web.xml
was having an extra tag before the <xml>
tag and it started with the <DOCTYPE>
tag instead.
So I removed the below tag which was the start tag,
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" >
and had the below tag,
<?xml version="1.0" encoding="UTF-8"?>
as the start tag of my web.xml
and it solved my issue.
Note: Please ensure there is no comments, tags, free spaces or any unwanted characters left before the <?xml ...?>
tag. This will mainly throw these type of error while parsing the xml files.