Monday, September 3, 2007

JBoss - JasperException in JSP using generics and 'for each'

JBoss 4.2.0 throws the following exception while using generics in JSP even if java version is 1.5 or greater

Syntax error, parameterized types are only available if source level is 5.0
Syntax error, 'for each' statements are only available if source level is 5.0

The workaround for this issue is to add the following XML configuration to
${jboss.home}/server/default/deploy/jboss-web.deployer/conf/web.xml

Add

<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>

inside <servlet> tag with <servlet-name>jsp</servlet-name> inside it.
(Note that there are many servlet tags in this web.xml, so be careful)

9 comments:

Anonymous said...

thank you !
this has perfectly solved my problem which was caused by this code:
List<> lp=new ArrayList<>();
with a class name between those <>
same error
Syntax error, parameterized types are only available if source level is 5.0

Cédric said...

Thank !!!
it worked my problem too, with a List

梦中林 said...

When the Wow Gold wolf finally found the Buy Wow Goldhole in the chimney he crawled wow gold cheap down and KERSPLASH right into that kettle of water and that was cheap wow gold the end of his troubles with the big bad wolf.
The next day the cheapest wow gold little pig invited his mother over . She said "You see it is just as mygamegoldI told you. The way to get along in the world is to do world of warcraft gold things as well as you can." Fortunately for that little pig, he buy cheap wow gold learned that lesson. And he just lived happily ever after! wow gold .

buy wow gold said...

When Wow Gold wolf finally found the wow gold cheap hole in the chimney he crawled cheap wow gold down and KERSPLASH right into that kettle of water and that was cheapest wow gold the end of his troubles with the big bad wolf.
game4power.
The next day the Buy Wow Goldlittle pig invited hisbuy gold wow mother over . She said "You see it is just as mygamegoldI told you. The way to get along in the world is to do world of warcraft gold things as well as you can." Fortunately for that little pig, he buy cheap wow gold learned that lesson. And he just k4gold lived happily ever after!.

ting said...

designer fashion handbags
Louis Vuitton
gucci
hermes
chanel
designer fashion handbags
replica Louis Vuitton handbags
replica gucci handbags
replica hermes handbags
replica chanel handbags
designer fashion handbags
designer Louis Vuitton handbags
designer gucci handbags
designer hermes handbags
designer chanel handbags
designer fashion handbags
knockoff Louis Vuitton handbags
knockoff gucci handbags
knockoff hermes handbags
knockoff chanel handbags
designer fashion handbags
cheap Louis Vuitton handbags
cheap gucci handbags
cheap hermes handbags
cheap chanel handbags
designer fashion handbags
discount Louis Vuitton handbags
discount gucci handbags
discount hermes handbags
discount chanel handbags

Louis Vuitton outlet
gucci outlet
chanel purses
hermes birkin
笑话大全

Anonymous said...

You are the guy. Thank you so much.

Anonymous said...

Thanks a lot. That helped.

Hk said...
This comment has been removed by the author.
Hk said...

I had the same issue on JBoss-4.0.5.GA, so I did the same that is suggested in this post, add those init parms to the servlet, and the problem was solved.

The path for the web.xml changed a little bit:

${jboss.home}/server/default/deploy/jbossweb-tomcat55.sar/conf/web.xml