Enabling JDK 1.5 Compilation Support for the Bundled Tomcat Web Server

See Also

By default, when you use the bundled Tomcat Web Server to compile a JSP file that uses JDK 1.5 constructs such as generics, you get an error such as the following:

org.apache.jasper.JasperException: Unable to compile class for JSP

The reason for this error is that the Tomcat Web Server does not have JDK 1.5 support enabled by default.

To enable JDK 1.5 support for the bundled Tomcat Web Server:

  1. Go to NetBeans_user_directory/apache-tomcat-5.5.17_base/conf/web.xml.
  2. Modify the JSP servlet by adding the tags that are highlighted in bold below:
    <servlet>
         <servlet-name>jsp</servlet-name>
         <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
         <init-param>
           <param-name>fork</param-name>
           <param-value>false</param-value>
         </init-param>
         <init-param>
           <param-name>xpoweredBy</param-name>
           <param-value>false</param-value>
         </init-param>
         <init-param>
           <param-name>compilerSourceVM</param-name>
           <param-value>1.5</param-value>
         </init-param>
         <init-param>
           <param-name>compilerTargetVM</param-name>
           <param-value>1.5</param-value>
         </init-param>
         <init-param>
           <param-name>mappedfile</param-name>
           <param-value>true</param-value>
         </init-param>
         <load-on-startup>3</load-on-startup>
    </servlet>
Note that this JDK 1.5 support will work only with the bundled Tomcat Web Server, since it is configured to use javac instead of the default jdt compiler. If an external Tomcat Web Server uses javac, the above instructions can be used for enabling JDK 1.5 compilation support.
See Also
About the Tomcat Web Server
Customizing the Tomcat Web Server
Registering an External Tomcat Web Server

Legal Notices