You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using zuul-core 1.3.0 with Spring-Cloud in a JDK 1.7 environment.
I started getting a strange error when executing zuul:
com.netflix.zuul.exception.ZuulException: Filter threw Exception
at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:227) [zuul-core-1.3.0.jar:1.3.0]
at com.netflix.zuul.FilterProcessor.runFilters(FilterProcessor.java:157) [zuul-core-1.3.0.jar:1.3.0]
at com.netflix.zuul.FilterProcessor.preRoute(FilterProcessor.java:133) [zuul-core-1.3.0.jar:1.3.0]
at com.netflix.zuul.ZuulRunner.preRoute(ZuulRunner.java:105) [zuul-core-1.3.0.jar:1.3.0]
at com.netflix.zuul.http.ZuulServlet.preRoute(ZuulServlet.java:125) [zuul-core-1.3.0.jar:1.3.0]
at com.netflix.zuul.http.ZuulServlet.service(ZuulServlet.java:74) [zuul-core-1.3.0.jar:1.3.0]
at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:157) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.cloud.netflix.zuul.web.ZuulController.handleRequest(ZuulController.java:44) [spring-cloud-netflix-core-1.4.3.RELEASE.jar:1.4.3.RELEASE]
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:624) [tomcat-embed-core-7.0.81.jar:7.0.81]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) [tomcat-embed-core-7.0.81.jar:7.0.81]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) [tomcat-embed-core-7.0.81.jar:7.0.81]
..........
Caused by: java.lang.NoSuchMethodError: com.netflix.zuul.context.RequestContext.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
at com.netflix.zuul.context.RequestContext.copy(RequestContext.java:546) ~[zuul-core-1.3.0.jar:1.3.0]
at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:190) ~[zuul-core-1.3.0.jar:1.3.0]
... 109 more
Basically it says that the method keySet() in ConcurrentHashMap, has different return type in JDK 1.7 and JDK 1.8. In JDK 1.7, it returns a Set and in JDK 1.8 it returns a KeySetView.
It my be possible that if you compile code using JDK 1.8, but with compatibility with JDK 1.7, this kind of errors may rise.
I checked that jar artifacts deployed on maven central, are compiled with JDK 1.8, and if you see the staktrace, the code specs a KeySetView.
I decompiled the source code of the jar, and if we inspect the bytecode of the RequestContext in the method copy():
Hello,
I am using zuul-core 1.3.0 with Spring-Cloud in a JDK 1.7 environment.
I started getting a strange error when executing zuul:
Apparently it seems all ok, but, after some hours of investigation, i arrived at this gist: https://gist.github.com/AlainODea/1375759b8720a3f9f094
Basically it says that the method keySet() in ConcurrentHashMap, has different return type in JDK 1.7 and JDK 1.8. In JDK 1.7, it returns a Set and in JDK 1.8 it returns a KeySetView.
It my be possible that if you compile code using JDK 1.8, but with compatibility with JDK 1.7, this kind of errors may rise.
I checked that jar artifacts deployed on maven central, are compiled with JDK 1.8, and if you see the staktrace, the code specs a KeySetView.
I decompiled the source code of the jar, and if we inspect the bytecode of the RequestContext in the method copy():
Effectively appears a reference to KeySetView, that does not exists in JDK 1.7.
The immediate solution to this problem, is compile the source code using JDK 1.7, and not using JDK 1.8.
I will try this to check if effectively compiling zuul with JDK 1.7 solves this problem.
The text was updated successfully, but these errors were encountered: