gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 12:21:30 25 4
gpt4 key购买 nike

我无法让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/38815088/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com