【发布时间】:2018-04-06 22:06:02
【问题描述】:
我不知道我是否遗漏了什么,但我有一个 Java 7、spring-boot 项目,我正在尝试导入和使用 htmlunit。 Htmlunit 使用 org/eclipse/jetty/websocket/api/Session 我得到了
java.lang.UnsupportedClassVersionError: org/eclipse/jetty/websocket/api/Session : Unsupported major.minor version 52.0
运行mvn dependency:tree我可以获得websocket版本:
[INFO] | +- net.sourceforge.htmlunit:htmlunit:jar:2.21:compile
[INFO] | | +- xalan:xalan:jar:2.5.1:compile
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.5.3:compile
[INFO] | | | \- org.apache.httpcomponents:httpcore:jar:4.4.8:compile
[INFO] | | +- org.apache.httpcomponents:httpmime:jar:4.5.3:compile
[INFO] | | +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.17:compile
[INFO] | | +- net.sourceforge.htmlunit:neko-htmlunit:jar:2.21:compile
[INFO] | | | \- xerces:xercesImpl:jar:2.8.1:provided
[INFO] | | | \- xml-apis:xml-apis:jar:1.4.01:provided
[INFO] | | +- net.sourceforge.cssparser:cssparser:jar:0.9.18:compile
[INFO] | | | \- org.w3c.css:sac:jar:1.3:compile
[INFO] | | \- org.eclipse.jetty.websocket:websocket-client:jar:9.4.7.v20170914:compile
[INFO] | | +- org.eclipse.jetty:jetty-client:jar:9.4.7.v20170914:compile
[INFO] | | | \- org.eclipse.jetty:jetty-http:jar:9.4.7.v20170914:compile
[INFO] | | +- org.eclipse.jetty:jetty-xml:jar:9.4.7.v20170914:compile
[INFO] | | +- org.eclipse.jetty:jetty-util:jar:9.4.7.v20170914:compile
[INFO] | | +- org.eclipse.jetty:jetty-io:jar:9.4.7.v20170914:compile
[INFO] | | \- org.eclipse.jetty.websocket:websocket-common:jar:9.4.7.v20170914:compile
[INFO] | | \- org.eclipse.jetty.websocket:websocket-api:jar:9.4.7.v20170914:compile
这确实是在 spring-boot https://github.com/spring-projects/spring-boot/issues/10396 的 1.5.8.RELEASE 上升级
所以..我错过了什么吗? spring boot 1.5.8 Java 7兼容吗?
编辑:https://github.com/eclipse/jetty.project/issues/2151 那么......我应该降级我的spring-boot版本吗?我还不能超过 Java 7。
【问题讨论】:
-
最好使用 java 8 或 9。
-
Java 10 现已推出。您需要使用另一个 Boot 版本,或者使用 Undertow 或 Tomcat。你也可以考虑提交一个针对 Boot 的错误。
-
Spring Boot 向后兼容。在最坏的情况下,您可以使用嗅探器检查是否存在兼容性。请查看spring.io/blog/2015/04/03/…
标签: java spring-boot jetty htmlunit