Bug#848612: tomcat8: NoSuchMethodError ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView with Java 7

Emmanuel Bourg ebourg at apache.org
Sun Dec 18 22:48:54 UTC 2016


Package: tomcat8
Version: 8.5.9-1
Severity: important

Tomcat 8 is compatible with Java 7 or higher, but the tomcat8 package
was built with Java 8 and using Java 7 at runtime may lead to this
error:

  java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
    at org.apache.catalina.core.ApplicationContext.getInitParameterNames(ApplicationContext.java:319)
    at org.apache.catalina.core.ApplicationContextFacade.getInitParameterNames(ApplicationContextFacade.java:368)

This error happens because the return type of ConcurrentHashMap.keySet()
changed in Java 8 from Set<K> to KeySetView<K,V>, and the KeySetView
class is new in Java 8. At compile time the signature of the method
used is recorded in the class file, and the Java 7 runtimes are unable
to resolve it.

The tomcat8 package should require a Java 8 runtime to avoid this issue.



More information about the pkg-java-maintainers mailing list