Issue
I am following the tutorial http://javanetbeans.net78.net/kb/60/web/tutorial-webapps.html
and when I get to the portion 'Creating a front controller using a servlet' I receive an error from Netbeans saying "Web application version is unsupported"
Using netbeans 6.8
Anyone able to explain why I am getting this prompt?
Here is the contents of my web-xml file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="/Midnight" version="2.5">
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>
Solution
See what value is set for the 'version' attribute in the <web-app>
element of your web.xml file. Here is an example from a version 2.5 web app:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<!-- The rest of your web.xml content -->
</web-app>
Maybe yours is set to something else not supported by the container.
Answered By - Jim Tough
Answer Checked By - David Marino (JavaFixing Volunteer)