Unable to compile class for JSP: The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files
You must use a more recent version of tomcat which has support for JDK 8.
I can confirm that apache-tomcat-7.0.35 does NOT have support for JDK8, I can also confirm that apache-tomcat-7.0.50 DOES have support for JDK8.
JDK8 - The type java.util.Map$Entry cannot be resolved
I have updated my glassfish application server and it has been solved my problem.
The type java.util.Map$Entry cannot be resolved (tomcat6 + JDK7)
Run Tomcat with Java 6 or upgrade to Tomcat 7 and make sure you don't have some old pre-Java 5/pre-generics library on the classpath.
Why do you get this error? Somewhere in the JSP code (not your code, mind), is a dependency on java.util.Map.Entry
. This could be in code which Jasper generates from your JSP.
It's not a direct dependency; rather your code (or the Java code generated from your JSP) needs something else which then needs java.util.Map.Entry
But the interface has changed in some way. Usually, that's with Java 8 because of the new static helper methods which they added: The name of the class is the same (which makes the error so confusing) but the API has changed and the code can't find something (or found something it didn't expect).
A similar problem can happen when you try to compile against a pre-generics class (even though that should work).
Even worse, import java.util.Map
in your JSP works. It's the existing bytecode somewhere else that causes the trouble.
[EDIT]
In my
/WEB-INF/lib/
folder I've:commons-fileupload
,commons-io
,poi
andrt
(may this one be the problem?)
Yes :-) rt.jar
is the Java runtime. It contains java.*
and in your case, a version of java.util.Map
which doesn't match the one from your Java VM.
Remote it and it should work.
Tomcat: java.util.Map$Entry cannot be resolved
This is an issue with dependencies. Please check you have the correct java version please not Tomcat 7.027 doesn't play well with java 8. Also in your dependencies ensure you have the correct version.
The type java.util.Map$Entry cannot be resolved
(Just for the sake of completeness.)
One reason might be that Tomcat 6 does not run with Java 8 (nor do some versions of Tomcat 7; I stumbled over that problem myself once):
https://stackoverflow.com/a/21322569/694804
So, it is highly suggested to use a recent version of Tomcat 7.0.x (or even 8) when using Java 8.
Related Topics
How to Enumerate All Classes in a Package and Add Them to a List
Javafx Automatic Resizing and Button Padding
Why Does Sun.Misc.Unsafe Exist, and How Can It Be Used in the Real World
How to Call a Method with a Separate Thread in Java
Scala Equivalent of Java Java.Lang.Class<T> Object
Preserving Parameter/Argument Names in Compiled Java Classes
Get Rid of "The Value for Annotation Attribute Must Be a Constant Expression" Message
Instance Method Reference and Lambda Parameters
Spring Resttemplate Get with Parameters
Why Does List<String>.Toarray() Return Object[] and Not String[]? How to Work Around This
Is Java a Compiled or an Interpreted Programming Language
The Simplest Way to Comma-Delimit a List
How to Make a Java Class That Implements One Interface with Two Generic Types