HTTP Status 500 - Unable to compile class for JSP:
type Exception report
message Unable to compile class for JSP:
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 10 in the jsp file: /pages/common/head.jsp Duplicate local variable basePath 7: --%> 8: <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9: <% 10: String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/"; 11: %> 12: <!--鍐檅ase鏍囩锛屾案杩滃浐瀹氱浉瀵硅矾寰勮烦杞殑缁撴灉--> 13: <base href=<%=basePath%>> Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:198) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457) org.apache.jasper.compiler.Compiler.compile(Compiler.java:363) org.apache.jasper.compiler.Compiler.compile(Compiler.java:338) org.apache.jasper.compiler.Compiler.compile(Compiler.java:325) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:580) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.50 logs.
你这个错误是因为head.jsp文件与当前页面文件定义了相同的变量basePath,导致变量重名引起的问题,删除当前页面或head.jsp的
basePath就可以了。
可以从新下载一个版本一致的jdk或者tomcat,jdk的话在本地需要配置环境变量,所以我建议你下载一个和jdk版本一致的tomcat,因为tomcat解压即可运行,如果你的jdk是32位的那么tomcat就下载32位的,同理如果jdk是64位的,tomcat就下载64位的,推荐jdk1.8,tomcat8
您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~
如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~
ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632