Professional Documents
Culture Documents
Error Displayed When Collections Using Generics Used in A JSP
Error Displayed When Collections Using Generics Used in A JSP
If a a JSP page uses collection using genrics , then it it displays error while executing in Jboss v4.2 application server . Problem lies in the fact that compiler setting of Jboss v4.2 is configured to accept only java 1.4 compatible code( and this compiler setting is used to compile the java file generated from a JSP) . Generics is available from Java5 . Solution is , compiler setting must be updated to Java5. Following is the solution : (I am assuming installation folder of Jboss v4.2 is : E:\jboss\jboss-4.2.1.GA) Befor doing all these steps application server must be stopped. From the installation folder , find a file web.xml in the following folder : server\default\deploy\jboss-web.deployer\conf Open the file web.xml and find the follwing entry : ( <servlet> tag with <servlet-name> value jsp ) (Note that there are many servlet tags in this web.xml, so be careful) <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> <!-- Use a custom options class to allow the shared tag lib descriptors to be loaded from jars in the tomcat sar conf/tlds directory. The standard options implementation can only find taglibs based on the class loader classpath. --> ----------------------------------------------------</servlet
Then insert following XML fragments after <servlet-class> tag <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> So it becomes like the following : <servlet> <servlet-name>jsp</servlet-name> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> <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>fork</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>xpoweredBy</param-name> <param-value>false</param-value> </init-param> <!-- Use a custom options class to allow the shared tag lib descriptors to be loaded from jars in the tomcat sar conf/tlds directory. The standard options implementation can only find taglibs based on the class loader classpath. --> --------------------------------------------</servlet> Then save the file and start the application server. Author : Titas RoyChowdhury (titas@globsyn.com) 2