java - 无法为 JSP 编译类 : The type java. util.Map$Entry 无法解析。它是从所需的 .class 文件中间接引用的

标签 java jsp tomcat servlets

我无法让tomcat7编译jsps。直到很好地运行示例 servlet 并且服务已启动并正在运行。我正在运行 oracle java 8。

谁能指出我正确的方向?

这是堆栈跟踪:

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: 1 in the generated java file
The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files

Stacktrace:
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.35 logs.

代码看起来像这样,它是来自 tomcat7 的示例代码,所以我猜它是正确的。

<%@ taglib prefix="mytag" uri="/WEB-INF/jsp2/jsp2-example-taglib.tld" %>
<html>
<head>
  <title>JSP 2.0 Examples - Hello World SimpleTag Handler</title>
</head>
<body>
<h1>JSP 2.0 Examples - Hello World SimpleTag Handler</h1>
<hr>
<p>This tag handler simply echos "Hello, World!"  It's an example of
a very basic SimpleTag handler with no body.</p>
<br>
<b><u>Result:</u></b>
<mytag:helloWorld/>
</body>
</html>

最佳答案

您必须使用支持 JDK 8 的更新版本的 tomcat。

我可以确认 apache-tomcat-7.0.35 不支持 JDK8,我也可以确认 apache-tomcat-7.0.50 支持 JDK8。

关于java - 无法为 JSP 编译类 : The type java. util.Map$Entry 无法解析。它是从所需的 .class 文件中间接引用的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19243458/

相关文章:

java - Libgdx批量绘制不可见纹理

java - 编译 .jsp 后的 .java 文件在哪里?

java - 在 Tomcat 从 SESSIONS.ser 反序列化后,你如何依赖注入(inject)标记为 @Configurable 的 bean?

Java构造函数模式

java - 无法在 Java 中使用 Jaxb 仅提取选定的标签值

jsp - 如何使 JSTL 库在 Ubuntu 上的 Tomcat 7 中工作

jakarta-ee - Jersey:区分 session 超时和未授权

java - Apache Tomcat 405 错误

java - Swing JLayeredPane 停止重新绘制所有图层

java - 如何在 JSP/Java 中创建多维 HashMap 或 Hashtable 并将其转换为 JSON 对象?