This is an automated email from the ASF dual-hosted git repository. jianbin pushed a commit to branch 2.x in repository https://gitbox.apache.org/repos/asf/incubator-seata.git
The following commit(s) were added to refs/heads/2.x by this push: new 4632770b21 bugfix: prefix: [seata.server.raft.ssl] should not be null (#7116) 4632770b21 is described below commit 4632770b217aca44e1ca22292b13d25fe1e67ae2 Author: funkye <jian...@apache.org> AuthorDate: Thu Jan 16 16:21:59 2025 +0800 bugfix: prefix: [seata.server.raft.ssl] should not be null (#7116) --- changes/en-us/2.x.md | 1 + changes/zh-cn/2.x.md | 1 + .../org/apache/seata/common/ConfigurationKeys.java | 16 ++++-- .../boot/autoconfigure/StarterConstants.java | 3 ++ .../SeataServerEnvironmentPostProcessor.java | 11 ++++- .../server/{ => raft}/ServerRaftProperties.java | 2 +- .../server/raft/ServerRaftSSLClientProperties.java | 57 ++++++++++++++++++++++ .../server/raft/ServerRaftSSLProperties.java | 57 ++++++++++++++++++++++ .../server/raft/ServerRaftSSLServerProperties.java | 57 ++++++++++++++++++++++ .../server/ServerRaftPropertiesTest.java | 1 + .../seata/server/cluster/raft/RaftServer.java | 10 ++-- .../server/instance/ServerInstanceFactory.java | 2 +- .../main/resources/application.raft.example.yml | 10 ++-- .../apache/seata/server/raft/RaftServerTest.java | 14 ++++++ 14 files changed, 226 insertions(+), 16 deletions(-) diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md index e8541f0476..5940b569f7 100644 --- a/changes/en-us/2.x.md +++ b/changes/en-us/2.x.md @@ -11,6 +11,7 @@ Add changes here for all PR submitted to the 2.x branch. ### bugfix: - [[#7104](https://github.com/apache/incubator-seata/pull/7104)] fix impl of supportsSourceType is not defined +- [[#7116](https://github.com/apache/incubator-seata/pull/7116)] fix prefix: seata.server.raft.ssl should not be null - [[#7112](https://github.com/apache/incubator-seata/pull/7112)] bugfix: remove the condition that IPv6 must start with fe80 diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md index e6f2d549c1..13e4e53183 100644 --- a/changes/zh-cn/2.x.md +++ b/changes/zh-cn/2.x.md @@ -11,6 +11,7 @@ ### bugfix: - [[#7104](https://github.com/apache/incubator-seata/pull/7104)] 修复SeataApplicationListener在低版本springboot未实现supportsSourceType方法的问题 +- [[#7116](https://github.com/apache/incubator-seata/pull/7116)] 修复 seata.server.raft.ssl 前缀不存在的问题 - [[#7112](https://github.com/apache/incubator-seata/pull/7112)] 校验是否IPv6网络ip取消必须以fe80开始的条件 ### optimize: diff --git a/common/src/main/java/org/apache/seata/common/ConfigurationKeys.java b/common/src/main/java/org/apache/seata/common/ConfigurationKeys.java index 3bb4c9873f..297d64167b 100644 --- a/common/src/main/java/org/apache/seata/common/ConfigurationKeys.java +++ b/common/src/main/java/org/apache/seata/common/ConfigurationKeys.java @@ -966,14 +966,24 @@ public interface ConfigurationKeys { /** - * The constant SERVER_RAFT_SSL_KEYSTORE_TYPE. + * The constant SERVER_RAFT_SSL_CLIENT_KEYSTORE_TYPE. */ - String SERVER_RAFT_SSL_KEYSTORE_TYPE = SERVER_RAFT_SSL + "keystore.type"; + String SERVER_RAFT_SSL_CLIENT_KEYSTORE_TYPE = SERVER_RAFT_SSL_CLIENT + "keystore.type"; + + /** + * The constant SERVER_RAFT_SSL_SERVER_KEYSTORE_TYPE. + */ + String SERVER_RAFT_SSL_SERVER_KEYSTORE_TYPE = SERVER_RAFT_SSL_SERVER + "keystore.type"; + + /** + * The constant SERVER_RAFT_SSL_KMF_ALGORITHM. + */ + String SERVER_RAFT_SSL_KMF_ALGORITHM = SERVER_RAFT_SSL + "kmfAlgorithm"; /** * The constant SERVER_RAFT_SSL_KMF_ALGORITHM. */ - String SERVER_RAFT_SSL_KMF_ALGORITHM = SERVER_RAFT_SSL + "kmf.algorithm"; + String SERVER_RAFT_SSL_TMF_ALGORITHM = SERVER_RAFT_SSL + "tmfAlgorithm"; /** * The constant SERVER_RAFT_MAX_APPEND_BUFFER_SIZE. diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/org/apache/seata/spring/boot/autoconfigure/StarterConstants.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/org/apache/seata/spring/boot/autoconfigure/StarterConstants.java index db09911af1..7a6c3c24e4 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/org/apache/seata/spring/boot/autoconfigure/StarterConstants.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/org/apache/seata/spring/boot/autoconfigure/StarterConstants.java @@ -73,6 +73,9 @@ public interface StarterConstants { String SERVER_PREFIX = SEATA_PREFIX + ".server"; String SERVER_UNDO_PREFIX = SERVER_PREFIX + ".undo"; String SERVER_RAFT_PREFIX = SERVER_PREFIX + ".raft"; + String SERVER_RAFT_SSL_PREFIX = SERVER_RAFT_PREFIX + ".ssl"; + String SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX = SERVER_RAFT_SSL_PREFIX + ".client.keystore"; + String SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX = SERVER_RAFT_SSL_PREFIX + ".server.keystore"; String SERVER_RECOVERY_PREFIX = SERVER_PREFIX + ".recovery"; String METRICS_PREFIX = SEATA_PREFIX + ".metrics"; diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/SeataServerEnvironmentPostProcessor.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/SeataServerEnvironmentPostProcessor.java index 9749a003d8..f20268cf0d 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/SeataServerEnvironmentPostProcessor.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/SeataServerEnvironmentPostProcessor.java @@ -17,10 +17,13 @@ package org.apache.seata.spring.boot.autoconfigure; import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftSSLClientProperties; +import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftSSLProperties; +import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftSSLServerProperties; import org.apache.seata.spring.boot.autoconfigure.properties.server.store.StoreProperties; import org.apache.seata.spring.boot.autoconfigure.properties.server.MetricsProperties; import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerProperties; -import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerRaftProperties; +import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftProperties; import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerRecoveryProperties; import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerUndoProperties; import org.apache.seata.spring.boot.autoconfigure.properties.server.session.SessionProperties; @@ -38,6 +41,9 @@ import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.METRIC import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.PROPERTY_BEAN_MAP; import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_PREFIX; import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_PREFIX; +import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX; +import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_PREFIX; +import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX; import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RECOVERY_PREFIX; import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_UNDO_PREFIX; import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SESSION_PREFIX; @@ -79,6 +85,9 @@ public class SeataServerEnvironmentPostProcessor implements EnvironmentPostProce PROPERTY_BEAN_MAP.put(STORE_REDIS_SINGLE_PREFIX, StoreRedisProperties.Single.class); PROPERTY_BEAN_MAP.put(STORE_REDIS_SENTINEL_PREFIX, StoreRedisProperties.Sentinel.class); PROPERTY_BEAN_MAP.put(SERVER_RAFT_PREFIX, ServerRaftProperties.class); + PROPERTY_BEAN_MAP.put(SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX, ServerRaftSSLServerProperties.class); + PROPERTY_BEAN_MAP.put(SERVER_RAFT_SSL_PREFIX, ServerRaftSSLProperties.class); + PROPERTY_BEAN_MAP.put(SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX, ServerRaftSSLClientProperties.class); PROPERTY_BEAN_MAP.put(SESSION_PREFIX, SessionProperties.class); PROPERTY_BEAN_MAP.put(STORE_PREFIX, StoreProperties.class); } diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/ServerRaftProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftProperties.java similarity index 99% rename from seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/ServerRaftProperties.java rename to seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftProperties.java index 5121b0dff8..4a3c3649b4 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/ServerRaftProperties.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftProperties.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.seata.spring.boot.autoconfigure.properties.server; +package org.apache.seata.spring.boot.autoconfigure.properties.server.raft; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLClientProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLClientProperties.java new file mode 100644 index 0000000000..3c91211857 --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLClientProperties.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.seata.spring.boot.autoconfigure.properties.server.raft; + +import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX) +public class ServerRaftSSLClientProperties { + + private String path = "ssl/cbolt.pfx"; + + private String password; + + private String type = "pkcs12"; + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLProperties.java new file mode 100644 index 0000000000..2239393525 --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLProperties.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.seata.spring.boot.autoconfigure.properties.server.raft; + +import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_PREFIX; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = SERVER_RAFT_SSL_PREFIX) +public class ServerRaftSSLProperties { + + private Boolean enabled = false; + + private String kmfAlgorithm = "SunX509"; + + private String tmfAlgorithm = "SunX509"; + + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public String getKmfAlgorithm() { + return kmfAlgorithm; + } + + public void setKmfAlgorithm(String kmfAlgorithm) { + this.kmfAlgorithm = kmfAlgorithm; + } + + public String getTmfAlgorithm() { + return tmfAlgorithm; + } + + public void setTmfAlgorithm(String tmfAlgorithm) { + this.tmfAlgorithm = tmfAlgorithm; + } +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLServerProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLServerProperties.java new file mode 100644 index 0000000000..8b4a2efc0d --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLServerProperties.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.seata.spring.boot.autoconfigure.properties.server.raft; + +import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX) +public class ServerRaftSSLServerProperties { + + private String path = "ssl/cbolt.pfx"; + + private String password; + + private String type = "pkcs12"; + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/org/apache/seata/spring/boot/autoconfigure/properties/server/ServerRaftPropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/org/apache/seata/spring/boot/autoconfigure/properties/server/ServerRaftPropertiesTest.java index 7c7e76892c..51e6df64ae 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/org/apache/seata/spring/boot/autoconfigure/properties/server/ServerRaftPropertiesTest.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/org/apache/seata/spring/boot/autoconfigure/properties/server/ServerRaftPropertiesTest.java @@ -16,6 +16,7 @@ */ package org.apache.seata.spring.boot.autoconfigure.properties.server; +import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftProperties; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/server/src/main/java/org/apache/seata/server/cluster/raft/RaftServer.java b/server/src/main/java/org/apache/seata/server/cluster/raft/RaftServer.java index ff3113e429..e2f6592afe 100644 --- a/server/src/main/java/org/apache/seata/server/cluster/raft/RaftServer.java +++ b/server/src/main/java/org/apache/seata/server/cluster/raft/RaftServer.java @@ -40,11 +40,13 @@ import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_REPORTER_ENA import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_REPORTER_INITIAL_DELAY; import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_CLIENT_KEYSTORE_PASSWORD; import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_CLIENT_KEYSTORE_PATH; +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_CLIENT_KEYSTORE_TYPE; import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_ENABLED; -import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_KEYSTORE_TYPE; import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_KMF_ALGORITHM; import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_SERVER_KEYSTORE_PASSWORD; import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_SERVER_KEYSTORE_PATH; +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_SERVER_KEYSTORE_TYPE; +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_TMF_ALGORITHM; import static org.apache.seata.common.DefaultValues.DEFAULT_RAFT_SSL_ENABLED; /** @@ -143,13 +145,13 @@ public class RaftServer implements Disposable, Closeable { setSystemProperty("bolt.server.ssl.keystore", instance.getConfig(SERVER_RAFT_SSL_SERVER_KEYSTORE_PATH)); setSystemProperty("bolt.server.ssl.keystore.password", instance.getConfig(SERVER_RAFT_SSL_SERVER_KEYSTORE_PASSWORD)); - setSystemProperty("bolt.server.ssl.keystore.type", instance.getConfig(SERVER_RAFT_SSL_KEYSTORE_TYPE)); + setSystemProperty("bolt.server.ssl.keystore.type", instance.getConfig(SERVER_RAFT_SSL_SERVER_KEYSTORE_TYPE)); setSystemProperty("bolt.server.ssl.kmf.algorithm", instance.getConfig(SERVER_RAFT_SSL_KMF_ALGORITHM)); setSystemProperty("bolt.client.ssl.keystore", instance.getConfig(SERVER_RAFT_SSL_CLIENT_KEYSTORE_PATH)); setSystemProperty("bolt.client.ssl.keystore.password", instance.getConfig(SERVER_RAFT_SSL_CLIENT_KEYSTORE_PASSWORD)); - setSystemProperty("bolt.client.ssl.keystore.type", instance.getConfig(SERVER_RAFT_SSL_KEYSTORE_TYPE)); - setSystemProperty("bolt.client.ssl.tmf.algorithm", instance.getConfig(SERVER_RAFT_SSL_KMF_ALGORITHM)); + setSystemProperty("bolt.client.ssl.keystore.type", instance.getConfig(SERVER_RAFT_SSL_CLIENT_KEYSTORE_TYPE)); + setSystemProperty("bolt.client.ssl.tmf.algorithm", instance.getConfig(SERVER_RAFT_SSL_TMF_ALGORITHM)); logger.info("Enable ssl communication between raft nodes"); } diff --git a/server/src/main/java/org/apache/seata/server/instance/ServerInstanceFactory.java b/server/src/main/java/org/apache/seata/server/instance/ServerInstanceFactory.java index 78842461e7..2a50b8da25 100644 --- a/server/src/main/java/org/apache/seata/server/instance/ServerInstanceFactory.java +++ b/server/src/main/java/org/apache/seata/server/instance/ServerInstanceFactory.java @@ -61,7 +61,6 @@ public class ServerInstanceFactory { private static final Logger LOGGER = LoggerFactory.getLogger(Server.class); public void serverInstanceInit() { - VGroupMappingStoreManager vGroupMappingStoreManager = SessionHolder.getRootVGroupMappingManager(); ConfigurableEnvironment environment = (ConfigurableEnvironment)ObjectHolder.INSTANCE.getObject(OBJECT_KEY_SPRING_CONFIGURABLE_ENVIRONMENT); @@ -101,6 +100,7 @@ public class ServerInstanceFactory { } instance.setTransaction(new Node.Endpoint(XID.getIpAddress(), XID.getPort(), "netty")); if (StringUtils.equals(registryProperties.getType(), NAMING_SERVER)) { + VGroupMappingStoreManager vGroupMappingStoreManager = SessionHolder.getRootVGroupMappingManager(); // load vgroup mapping relationship instance.addMetadata("vGroup", vGroupMappingStoreManager.loadVGroups()); EXECUTOR_SERVICE = diff --git a/server/src/main/resources/application.raft.example.yml b/server/src/main/resources/application.raft.example.yml index 241820a1d2..c427dce576 100644 --- a/server/src/main/resources/application.raft.example.yml +++ b/server/src/main/resources/application.raft.example.yml @@ -97,17 +97,15 @@ seata: client: keystore: path: ssl/cbolt.pfx - password: seata + password: type: pkcs12 server: keystore: path: ssl/bolt.pfx - password: seata + password: type: pkcs12 - kmf: - algorithm: SunX509 - tmf: - algorithm: SunX509 + kmf-algorithm: SunX509 + tmf-algorithm: SunX509 service-port: 8091 #If not configured, the default is '${server.port} + 1000' max-commit-retry-timeout: -1 max-rollback-retry-timeout: -1 diff --git a/server/src/test/java/org/apache/seata/server/raft/RaftServerTest.java b/server/src/test/java/org/apache/seata/server/raft/RaftServerTest.java index a85de53606..4633a2d500 100644 --- a/server/src/test/java/org/apache/seata/server/raft/RaftServerTest.java +++ b/server/src/test/java/org/apache/seata/server/raft/RaftServerTest.java @@ -19,6 +19,7 @@ package org.apache.seata.server.raft; import org.apache.seata.common.ConfigurationKeys; import org.apache.seata.common.XID; import org.apache.seata.config.ConfigurationCache; +import org.apache.seata.config.ConfigurationFactory; import org.apache.seata.server.cluster.raft.RaftServerManager; import org.apache.seata.server.lock.LockerManagerFactory; import org.apache.seata.server.session.SessionHolder; @@ -30,6 +31,14 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.ApplicationContext; + +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_CLIENT_KEYSTORE_PATH; +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_ENABLED; +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_KMF_ALGORITHM; +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_SERVER_KEYSTORE_PATH; +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_TMF_ALGORITHM; +import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_PREFIX; + @SpringBootTest public class RaftServerTest { @@ -51,6 +60,11 @@ public class RaftServerTest { @Test public void initRaftServerStart() { + Assertions.assertDoesNotThrow(()-> ConfigurationFactory.getInstance().getConfig(SERVER_RAFT_SSL_ENABLED)); + Assertions.assertDoesNotThrow(()-> ConfigurationFactory.getInstance().getConfig(SERVER_RAFT_SSL_CLIENT_KEYSTORE_PATH)); + Assertions.assertDoesNotThrow(()-> ConfigurationFactory.getInstance().getConfig(SERVER_RAFT_SSL_SERVER_KEYSTORE_PATH)); + Assertions.assertDoesNotThrow(()-> ConfigurationFactory.getInstance().getConfig(SERVER_RAFT_SSL_KMF_ALGORITHM)); + Assertions.assertDoesNotThrow(()-> ConfigurationFactory.getInstance().getConfig(SERVER_RAFT_SSL_TMF_ALGORITHM)); System.setProperty("server.raftPort", "9091"); System.setProperty(ConfigurationKeys.SERVER_RAFT_SERVER_ADDR, XID.getIpAddress() + ":9091" + "," + XID.getIpAddress() + ":9092" + "," + XID.getIpAddress() + ":9093"); --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For additional commands, e-mail: notifications-h...@seata.apache.org