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版本即可。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
SSM是指Spring+SpringMVC+MyBatis的组合,是一种常用的Java Web开发框架。下面是一个简单的介绍和演示: 1. SpringSpring是一个轻量级的Java开发框架,提供了依赖注入和面向切面编程等功能,可以简化Java应用程序的开发。 2. SpringMVC:SpringMVC是基于Spring框架的Web开发框架,它使用MVC(Model-View-Controller)的设计模式,将应用程序的逻辑分为模型、视图和控制器三个部分,使开发更加模块化和易于维护。 3. MyBatis:MyBatis是一个持久层框架,它可以将数据库操作与Java对象的映射关系进行配置,提供了方便的SQL查询和事务管理功能。 下面是一个简单的演示代码: ```java // 1. 创建一个Spring配置文件 applicationContext.xml,配置Spring相关的bean和数据库连接等信息 // 2. 创建一个SpringMVC配置文件 springmvc.xml,配置SpringMVC相关的bean和请求映射等信息 // 3. 创建一个MyBatis配置文件 mybatis-config.xml,配置MyBatis相关的数据库连接和映射文件等信息 // 4. 创建一个Java类 UserController,用于处理用户相关的请求和业务逻辑 @Controller @RequestMapping("/user") public class UserController { @Autowired private UserService userService; @RequestMapping("/list") public String userList(Model model) { List<User> userList = userService.getUserList(); model.addAttribute("userList", userList); return "userList"; } } // 5. 创建一个Java类 UserService,用于处理用户相关的业务逻辑 @Service public class UserService { @Autowired private UserMapper userMapper; public List<User> getUserList() { return userMapper.getUserList(); } } // 6. 创建一个Java接口 UserMapper,用于定义用户相关的数据库操作方法 public interface UserMapper { List<User> getUserList(); } // 7. 创建一个Java类 User,用于表示用户对象 public class User { private Integer id; private String username; private String password; // 省略getter和setter方法 } // 8. 创建一个JSP页面 userList.jsp,用于显示用户列表 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>User List</title> </head> <body> <h1>User List</h1> <table> <tr> <th>ID</th> <th>Username</th> <th>Password</th> </tr> <c:forEach items="${userList}" var="user"> <tr> <td>${user.id}</td> <td>${user.username}</td> <td>${user.password}</td> </tr> </c:forEach> </table> </body> </html> ``` 以上是一个简单的SSM框架的介绍和演示,通过SpringSpringMVC和MyBatis的组合,可以实现Java Web应用程序的开发和数据库操作。如果你有任何问题,请随时提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值