While working with java web application development often we need to install applications again and again on web server / application server. And often when we deploy application after modification to web.xml application fails to get deployed giving long error in Tomcat ( or any other server) console.
To check validation of web.xml before deploying we can validate it with standard web.xml dtd
I used ant to handle deployment / stopping / starting application in tomcat.
You can use the following ant task to check validation of web.xml
<target name="checkwebxml" description="Validate the web xml">
<xmlvalidate failonerror="yes" lenient="yes" warn="yes" file="./web/WEB-INF/web.xml">
<dtd publicId="-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
location="web-app_3_0.dtd"/>
</xmlvalidate>
</target>
You can make compilation target dependent on checkwebxml task so that compilation and deployment doesn't starts before validation of web.xml
This will ease our task to find error in tomcat console when we try to deploy our application
No comments:
Post a Comment
Please share your views and comments below.
Thank You.