背景介紹:
1. 工程依賴: rocketmq , rockmq 需要依賴 netty (但是rocketmq沒有直接把netty 依賴帶進來)
2. 工程通過 spring-boot-starter-data-redis 間接將 netty 依賴進來了
操作
1. 排除 lettuce-core, 也就把 netty 排除出去了。
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <exclusions> <exclusion> <groupId>io.lettuce</groupId> <artifactId>lettuce-core</artifactId> </exclusion> </exclusions> </dependency>
結果(現象):
1. maven 打包沒問題
2. 啓動的時候報錯: class not found
解決辦法:
1. 理解類似的原因, 可能是間接的依賴包由於各種原因沒有依賴進來(maven 可以打包成功)
2. 查看日誌,確認原因。