[置顶] The type java.util.Map$Entry cannot be resolved问题的解决

时间:2022-09-23 19:36:04

开门见山(这是一首歌)

一、异常信息

我这里遇到的异常信息详细如下:

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: [1] in the generated java file: [D:\yonyounc\work\server\bright\localhost\_\org\apache\jsp\admin_jsp.java]
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:103)
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:722)
sun.reflect.GeneratedMethodAccessor535.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:483)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:277)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:1)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:549)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:309)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:169)
java.security.AccessController.doPrivileged(Native Method)
nc.bs.framework.server.LoggerServletFilter.doFilter(LoggerServletFilter.java:35)
sun.reflect.GeneratedMethodAccessor540.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:483)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:277)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:1)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:549)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:309)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:249)
note The full stack trace of the root cause is available in the UAP Server logs.

二、异常处理

2.1说明

    异常出现时本地配置JDK版本为JDK8,java version "1.8.0_20"。

2.2问题解决

    JDK版本问题。把JDK8换成JDK7即可。

2.3其他解决方案

    1)JDK换成低版本JDK8-JDK6

    2)Tomcat版本换成Tomcat8

    3)更新开发工具

2.4问题解释

    1)使用的开发工具对JDK8还不完全支持

    2)编译版本和运行版本不一致

    3)老版本的eclipse不兼容JDK8

    4)It means: "A class that you use needs an other class that is not on the classpath." You should make sure to add the required jar to the classpath.