开发者

jasper/JSP precompile problem with migration to Tomcat 7 - NumberFormatException: For input string

I've got a working webapp running on Tomcat 5.5 that I'm trying to port to Tomcat 7. I'm running into a problem when trying to precompile some JSPs with Jasper2. I get: java.lang.NumberFormatException: For input string: "${startYear}"

I believe the issue is that this new version of Jasper (JSP 2.1 impl) is trying to dereference ${startYear} during precompilation. With the older version I see ${startYear} in the generated Java file.

I'm s开发者_运维技巧ure this is some config or classpath issue I'm missing, but I can't find any good links to a solution. BTW - I can get it to work by reverting back to the Jasper jars that come with 5.5, but I'd rather not do that if I can avoid it.

thanks for any tips


Look like that you've a dangling JSTL 1.0 library around in your webapp's /WEB-INF/lib. EL expressions are compiled and evaluated differently. Remove both the old JSTL 1.0 jstl.jar and standard.jar files and put a fresh new JSTL 1.2 jstl-1.2.jar file in place.

Don't forget to update the JSTL taglib URIs in any JSP to include the new /jsp prefix which was introduced since JSTL 1.1. E.g.

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


BalusC's answer is one possible cause, but even with just the correct JARs in the classpath the problem can still occur. I found it was also necessary to update the web.xml to a newer version of the servlet specification - 3.0 (for Tomcat 7) or 2.5 (for Tomcat 6).

See the JSTL tag info page for more details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜