I am using the Wrox SCWCD book. In the 6th chapter the authors have given an example to demonstrate Secure Servlets. According to the book the below mentioned code should be inserted in the deployment descriptor (web.xml). <servlet> <servlet-name>Secure</servlet-name> <servlet-class>SecureServlet</servlet-class> </servlet>
I have inserted the code in install_dir/webapps/ROOT/WEB-INF/web.xml file . If I am not wrong this is what is called the deployment descriptor. But now when I start the server, it throws an exception and the screen is cluttered with a large stack trace. But when I comment the above made changes it works fine. What could be the problem? How do I write Secure Servlets by making use of the Deployment Descriptor. I will be obliged if anybody can help me. Regards, Kunal Jaggi SCJP2
Based on your description of the symptoms, my first suggestion would be to ensure that the order of elements in the deployment descriptor is correct. The container is sensitive to the order of elements in the deployment descriptor. My experience has been that if any element is out of place, the container throws an exception, which is the symptom you describe. As soon as you remove the elements, the deployment descriptor is again in the correct order, so then it works. The order of elements you show in your message is correct, however, they must also be correct in relation to the other elements in the deployment descriptor. Check here to see the order of elements shown in tree form. Another technique to narrow down the problem is to add each element one by one, restarting each time, until you find the specific element that is causing the problem. Then you need to check that element carefully for the correct syntax, required subelements, etc.
It's a beautiful day in this neighborhood - Fred Rogers. Tiny ad: