我是靠谱客的博主 慈祥抽屉,最近开发中收集的这篇文章主要介绍SSM升级JDK1.8,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

【背景】因基础组件的升级,必须使用jdk1.8以上版本

【步骤-升级JDK8】

1、升级maven编译器,修改pom中编译器Java版本
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
    </configuration>
2、升级maven编译器,修改pom中编译器Java版本
 Settings
        点击 File > Settings > Java Compiler

        Project bytecode version 选择 1.8

        点击 File > Settings > Build Tools > Maven > Importing

        选择 JDK for importer 为 1.8

 Projcet Settings
        Project SDK 选择 1.8
3、升级Spring的版本

spring只能升级到4.1.9,不然common-jdbc那边org.springframework.jdbc.core.JdbcTemplate.queryForLong不兼容

4、修改配置文件.xml上的标识
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans3.0.xsd">
		......
</beans>

修改为

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd">
		......
</beans>
【步骤-升级Jetty9】

​ JDK8 对应 JETTY 9 版本 低版本会报错

【遇到的坑】

​ 1、内部RPC框架升级版本的时候会无法创建RPC_CLIENT_BEAN,一直刷java.lang.NoSuchMethodError:Error creating bean with name ‘xxxService’,Invocation of init method failed;

​ 答:需要在xml文件中rpc:application

​ 2、Jetty启动不起来,一直刷java.lang.RuntimeException: Error scanning entry module-info.class from jar file

​ 答:这个毫无疑问的是jetty版本的问题, module-info.classs模块化是属于JDK版本9的东西,在Jetty版本更新说明VERSION.TXT中有说明,最低jetty-9.3.22版本中会有Annotion scanning should ignore ‘module-info.class’files,说明会忽视掉module-info.class

​ 所以升级jdk8对应的jetty版本必须是jetty-9.3.22或以上。

以下截至jetty的VERSION.TXT

jetty-9.3.22.v20171030 - 30 October 2017
 + 1213 Upgrade to ASM Version 6.0_ALPHA for JDK9
 ***
 + 1692 Annotation scanning should ignore `module-info.class` files
 ***
 + 1705 Rejected executions in QueuedThreadPool can lead to memory leaks
 + 1797 JEP 238 - Multi-Release JAR files break bytecode scanning
 + 1814 Move JavaVersion to jetty-util for future Java 9 support requirements
 + 1901 Reimplement PathWatcher as scanner
 + 1912 AbstractConnector EndPoint leak for failed SSL connections
 + 1914 jetty client fails to parse response with RFC2045 conformant
   Content-Type: charset="utf-8"
 + 1928 Backport #1705 to jetty-9.3.x. Fixed leak on Rejected execution

jetty-9.4.6.v20170531 - 31 May 2017
 + 523 TLS close behaviour breaking session resumption
 + 1108 Please improve logging in SslContextFactory when there are no approved
   cipher suites
 + 1505 Adding jetty.base.uri and jetty.home.uri
 + 1514 websocket dump badly formatted
 + 1516 Delay starting of WebSocketClient until an attempt to connect is made
 + 1520 PropertyUserStore should extract packed config file
 + 1526 MongoSessionDataStore old session scavenging is broken due to the
   missing $ sign in "and" operation
 + 1527 Jetty BOM should not depend on jetty-parent
 + 1528 Internal HttpClient usages should have common configurable technique
 + 1536 Jetty BOM should include more artifacts
 + 1538 NPE in Response.putHeaders
 + 1539 JarFileResource mishandles paths with spaces
 + 1544 Disabling JSR-356 doesn't indicate context it was disabled for
 + 1546 Improve handling of quotes in cookies
 + 1553 X509.isCertSign() can throw ArrayIndexOutOfBoundsException on
   non-standard implementations
 + 1556 A timing channel in Password.java
 + 1558 When creating WebAppContext without session-config and with NO_SESSIONS
   throws NPE
 + 1567 XmlConfiguration will start the same object multiple times
 + 1568 ServletUpgradeRequest mangles query strings containing percent-escapes
   by re-escaping them
 + 1569 Allow setting of maxBinaryMessageSize to 0 in WebSocketPolicy
 + 1579 NPE in Quoted Quality CSV

​ 3、zookeeper底层依赖冲突

​ 答:因为zookeeper的netty依赖版本为org.jboss版本,内部RPC框架依赖的netty为io.netty版本,造成了服务起不来,只要统一netty版本即可。

最后

以上就是慈祥抽屉为你收集整理的SSM升级JDK1.8的全部内容,希望文章能够帮你解决SSM升级JDK1.8所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(47)

评论列表共有 0 条评论

立即
投稿
返回
顶部