我不知道是不是遗漏了什么,但是我有一个Java 7,spring引导项目,在这里我试图导入和使用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 i可以获得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它确实是在1.5.8上升级的。弹簧引导https://github.com/spring-projects/spring-boot/issues/10396的upgrade
所以..。我是不是遗漏了什么?spring 1.5.8Java 7兼容吗?
编辑:https://github.com/eclipse/jetty.project/issues/2151所以..。我是不是应该降级我的春季启动版本?我还不能通过Java 7。
发布于 2018-04-06 22:29:22
这里有两种不同的东西:SpringBoot1.5.x本身需要JDK7+,但是这个要求可以根据您对容器的选择而改变。
Jetty 9.3+需要JDK8,但是使用Jetty9.2应该适用于JDK7 (参见SpringBoot1.5.x系统需求页面)。
通过更改<jetty.version> maven属性来降级您的jetty依赖应该足够了。
Spring构建示例应用程序来演示兼容性- 这里是SpringBoot1.5.x+Jetty9.2的一个。
https://stackoverflow.com/questions/49701592
复制相似问题