升级jdk17遇到的坑

升级jdk17遇到的坑

1、证书问题

公司的base image是有证书版本的,没证书版本的,一开始没引用正确导致改了好多配置,忽略证书、替换证书无用功等等

2、jdk17可能会遇到反射等问题,要在pom里面加入配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/java.lang=ALL-UNNAMED
</jvmArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>

</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<argLine>
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
</plugins>
</build>

3、k8s配置问题

声明变量到application

读取backing service的时候,自定义的名字要替换到application.yml里面,记得在env里面声明。

1
2
3
4
env:
SERVER.NAME: ${SERVER.NAME}
JAVA_OPTS: ${JAVA_OPTS}
SPRING_PROFILES_ACTIVE: ${profile}

延迟加载

把初始化延迟检查调大点,以防pod反复重启

1
2
3
4
startup-probe:
initial-check-delay: 120
retry-interval: 10
max-check-times: 1

4、springcloud-stream 引入rabbitmq

起初只有solace这个消息队列,时代在发展,微服务准备接入rabbitmq,逐步抛弃solace。当前的阶段是两个同时用,然后就产生了2个binder问题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
cloud:
stream:
function:
definition: aaa;rabbitaaa
binders:
solace:
type: solace
rabbit:
type: rabbit
rabbit:
default:
consumer:
rebalancerCompany: ${COMPANY}
solace:
default:
consumer:
autoCreateEndpoints: false
topicPatternCompany: ${SOLACE_CARRIER}
topicPatternApp: ECM
topicPatternComponent: xxx_ACL
autoBindDmq: true
transportWindowSize: 50
bindings:
aaa-in-0:
binder: solace
destination: ${SOLACE_CARRIER}/xxx/DOCUMENT_DM_RESULT/ACL
contentType: application/json
group: xxx_acl
consumer:
concurrency: 4
partitioned: true
max-attempts: 3
rabbitaaa-in-0:
binder: rabbit
destination: ${RABBIT_CARRIER}.xxx.DOCUMENT_DM_RESULT.ACL
contentType: application/json
group: XXX_ACL
consumer:
partitioned: true
max-attempts: 3

hexo 本地启动命令是什么: hexo s

hexo清除缓存: hexo clean

hexo本地build:hexo g

hexo 远程推送: hexo d


升级jdk17遇到的坑
https://liu-cj25.github.io/2025/06/04/升级jdk17踩坑/
Author
cj
Posted on
June 4, 2025
Licensed under