tomcat 6 部署 cas3.3.1 server 访问报错。
最近在弄SSO,准备用CAS认证,教程上用的是tomcat5.5,我自己用tomcat6,结果部署后,访问https://localhost:8443/cas 报错 错误如下:
?
?
HTTP Status 500 - type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: /WEB-INF/view/jsp/default/ui/casLoginView.jsp(48,35) Attribute value request.getQueryString() == null ? "" : request.getQueryString().replaceAll("&locale=([A-Za-z][A-Za-z]_)?[A-Za-z][A-Za-z]|^locale=([A-Za-z][A-Za-z]_)?[A-Za-z][A-Za-z]", "") is quoted with " which must be escaped when used within the valueorg.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:198)org.apache.jasper.compiler.Parser.parseQuoted(Parser.java:301)org.apache.jasper.compiler.Parser.parseAttributeValue(Parser.java:250)org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:212)org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:155)org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1252)org.apache.jasper.compiler.Parser.parseElements(Parser.java:1467)org.apache.jasper.compiler.Parser.parseBody(Parser.java:1675)org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1022)org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1290)org.apache.jasper.compiler.Parser.parseElements(Parser.java:1467)org.apache.jasper.compiler.Parser.parse(Parser.java:138)org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:154)org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)javax.servlet.http.HttpServlet.service(HttpServlet.java:717)org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:142)org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:243)org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1141)org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:878)org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:475)org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:430)javax.servlet.http.HttpServlet.service(HttpServlet.java:617)javax.servlet.http.HttpServlet.service(HttpServlet.java:717)org.jasig.cas.web.init.SafeDispatcherServlet.service(SafeDispatcherServlet.java:115)note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.
?
使用将 WEB-INF\view\jsp\default\ui\casLoginView.jsp中
<!--也许是tomcat版本问题导致,替换为下面的代码<c:set var="query" value="<%=request.getQueryString() == null ? "" : request.getQueryString().replaceAll("&locale=([A-Za-z][A-Za-z]_)?[A-Za-z][A-Za-z]|^locale=([A-Za-z][A-Za-z]_)?[A-Za-z][A-Za-z]", "")%>" /> <c:set var="query" value="<%=request.getQueryString() == null ? "" : request.getQueryString().replaceAll("&locale=([A-Za-z][A-Za-z]_)?[A-Za-z][A-Za-z]|^locale=([A-Za-z][A-Za-z]_)?[A-Za-z][A-Za-z]", "")%>" />--> <c:set var="query" value="<%=request.getQueryString() == null ? "" : request.getQueryString().replaceAll("&locale=([A-Za-z][A-Za-z]_)?[A-Za-z][A-Za-z]|^locale=([A-Za-z][A-Za-z]_)?[A-Za-z][A-Za-z]", "")%>" />
?
修改了也没用,后来找到老外的解决方法
在catalina.bat中,在里面(前面)加上设置参数:
export JAVA_OPTS="-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false"
?
结果小猫都启不动了
我自己修改为:
set JAVA_OPTS="-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false"
?
启动小猫,访问https://localhost:8443/cas
终于看到登录的界面了。
?
被修改的那个参数具体描述请看:http://tomcat.apache.org/tomcat-5.5-doc/config/systemprops.html
?
?
1 楼 littlecong 2009-09-21 两个修改看起来是一样的,可能只是unix和windows上的差别