Error when using LogManager (l4j2) with Java 8 (java.lang.reflect.AnnotatedElement cannot be resolved)
When using JDK 8 and an IDE (or any other code processing tool/framework) with its own compiler, like Eclipse, you have to update the tool to a version with Java 8 support, even if you are not using the newer Java 8 features.
The reason is that the compiler must be able to load the newer class files of the JRE in order to compile your software which references these classes.
Sometimes you can get away with an older compiler when it ignores the newer version number of the class files. But some types will confuse older class file parsers as they use new features, notably AnnotatedElement
, which now has default
methods, and Map.Entry
, an interface
which now has static
methods.
It seems that Eclipse does not make a difference between references for which no class file could be found and class files it failed to read when saying “«classname» cannot be resolved”.
The same applies to all tools and frameworks using ECJ as embedded compiler.
JDK 8 - The type java.util.Map$Entry cannot be resolved
This was fixed by changing my Eclipse IDE version from indigo to luna. Luna comes with support for Java 8 so all issues have now been resolved.
JDK8 - The type java.util.Map$Entry cannot be resolved
I have updated my glassfish application server and it has been solved my problem.
Related Topics
How to Rotate an Image Gradually in Swing
How to Directly Initialize a Hashmap (In a Literal Way)
Using Regular Expressions to Extract a Value in Java
Implementing Two Interfaces in a Class with Same Method. Which Interface Method Is Overridden
Java Event-Dispatching Thread Explanation
Removing an Element from an Array (Java)
How to Upload File Using Selenium Webdriver in Java
Why Does Runtime.Exec(String) Work for Some But Not All Commands
Difference Between Regex [A-Z] and [A-Za-Z]
What's the Difference Between Fx:Id and Id: in Javafx
How to Construct a Relative Path in Java from Two Absolute Paths (Or Urls)
How Does a Arraylist's Contains() Method Evaluate Objects
Handling Interruptedexception in Java
Java.Sql.Sqlexception: - Ora-01000: Maximum Open Cursors Exceeded