Ever used JBoss (or any other similar server that wraps around Tomcat) and when you try something related to Java 5.0 in your jsp scriptlet like
<% java.util.Map map = java.util.Set<java.util.Map.Entry><String, String="">> Set = map.entrySet();
%>
The whole thing bombs giving you an arcane description saying:
"Syntax error, parameterized types are only available if source level is 5.0"
JBoss uses the Apache Jasper JSP Compiler internally.
Jasper compiler settings (inspite of what your JVM settings may dictate) internally has runtime and compile time jvm settings which conveniently default to Java 1.4 .
A newbie or someone who hasn't looked at JBoss settings beyond the usual jboss-service.xml, is left scratching his or her scalp (after all, by this time you'd have lost most of your hair) as to what's going on.
To put it simply, move to
<jboss_install>\server\<jboss_app_folder>\deploy\jboss-web.deployer\conf\web.xml
Look for
<servlet-class>
org.apache.jasper.servlet.JspServlet
</servlet-class>
This is the place where you specify the Jasper jsp compiler and runtime settings.
Simply add the following lines to any existing "init-param" settings
<init-param>
<param-name>compilerTargetVM</param-name>
<param-value>1.5</param-value>
</init-param>
<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.5</param-value>
</init-param>
Restart your jboss instance and voila !!! The problem disappears.
Friday, June 06, 2008
Subscribe to:
Posts (Atom)