我们有一个托管在Tomcat 7服务器中的JSP应用程序。作为构建过程的一部分,我们有一些自动化测试运行,通过HtmlUnit调用这些JSP页面。 当一些测试尝试访问JSP文件时,我们注意到了间歇性的JSP编译错误。这似乎没有与任何特定的测试相关联。JSP编译错误 - 令牌“抛出”的语法错误,抛出预期
我们已经有比如上次编译错误是:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: [1] in the generated java file: [/tmp/myproject/work/Tomcat/localhost/_/org/apache/jsp/WEB_002dINF/jsp/admin/home_jsp.java]
Syntax error on tokens, delete these tokens
An error occurred at line: [97] in the generated java file: [/tmp/myproject/work/Tomcat/localhost/_/org/apache/jsp/WEB_002dINF/jsp/admin/home_jsp.java]
Syntax error on token(s), misplaced construct(s)
An error occurred at line: 1 in the jsp file: /WEB-INF/jspf/taglibs.jspf
Syntax error on tokens, delete these tokens
1: <%@ taglib uri="http://www.springframework.org/security/tags" prefix="authz" %>
2: <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
3: <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
4: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
An error occurred at line: 1 in the jsp file: /WEB-INF/jspf/taglibs.jspf
Syntax error on token "}", delete this token
1: <%@ taglib uri="http://www.springframework.org/security/tags" prefix="authz" %>
2: <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
3: <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
4: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
An error occurred at line: 1 in the jsp file: /WEB-INF/jspf/taglibs.jspf
Syntax error on token "(", ; expected
1: <%@ taglib uri="http://www.springframework.org/security/tags" prefix="authz" %>
2: <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
3: <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
4: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
An error occurred at line: 1 in the jsp file: /WEB-INF/jspf/taglibs.jspf
Syntax error on token(s), misplaced construct(s)
1: <%@ taglib uri="http://www.springframework.org/security/tags" prefix="authz" %>
2: <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
3: <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
4: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
An error occurred at line: 1 in the jsp file: /WEB-INF/jspf/taglibs.jspf
Syntax error on token(s), misplaced construct(s)
1: <%@ taglib uri="http://www.springframework.org/security/tags" prefix="authz" %>
2: <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
3: <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
4: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
An error occurred at line: 1 in the jsp file: /WEB-INF/jspf/taglibs.jspf
Syntax error on token "throws", throw expected
1: <%@ taglib uri="http://www.springframework.org/security/tags" prefix="authz" %>
2: <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
3: <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
4: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
An error occurred at line: 1 in the jsp file: /WEB-INF/jsp/admin/home.jsp
Syntax error on token "}", delete this token
1: <%@ include file="/WEB-INF/jspf/taglibs.jspf" %>
2: <html>
3: <head>
4: <title>Administrator Home</title>
我们没有看到无论是在我们当地的环境,也没有在任何其他环境比我们负责运行这些系统测试环境这些错误,是的,我们使用相同的代码库。
这些错误似乎只在第一次访问JSP文件时发生,因为我可以在Tomcat的jsp工作目录中看到有一个home_jsp.java和一个home_jsp.class,这意味着该jsp文件已正确翻译成一个servlet类,然后正确编译。另外,我查看了home_jsp.java文件,看不到与JSP编译器报告的编译错误相对应的任何明显错误。
任何意见/建议,以帮助解决这个问题,表示赞赏。
干杯, 奥利维尔