.Ruo 2021-06-18 20:32 采纳率: 100%
浏览 56
已采纳

如何处理如下tomcat和jdk不一致的情况

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.

  • 写回答

3条回答 默认 最新

  • 关注

    你这个错误是因为head.jsp文件与当前页面文件定义了相同的变量basePath,导致变量重名引起的问题,删除当前页面或head.jsp的

    basePath就可以了。
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器