hazelcast - 在 Quarkus 中配置集群 Vertx Eventbus 的问题

标签 hazelcast vert.x quarkus vertx-eventbus

我正在使用:

  • Quarkus 1.6.1.Final
  • Vertx 3.9.1(由 quarkus-vertx 依赖提供,见下面的 pom.xml)

而且我无法让 clusered Eventbus 工作。我已按照此处列出的说明进行操作:

https://vertx.io/docs/vertx-hazelcast/java/

我还在 Quarkus 中启用了集群:

quarkus.vertx.cluster.clustered=true
quarkus.vertx.cluster.port=8081
quarkus.vertx.prefer-native-transport=true
quarkus.http.port=8080

这是我的 pom.xml:

    <dependencies>
    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-resteasy</artifactId>
    </dependency>
    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-resteasy-mutiny</artifactId>
    </dependency>
    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-vertx</artifactId>
    </dependency>
    <dependency>
        <groupId>io.vertx</groupId>
        <artifactId>vertx-hazelcast</artifactId>
        <version>3.9.2</version>
        <exclusions>
            <exclusion>
                <groupId>io.vertx</groupId>
                <artifactId>vertx-core</artifactId>
            </exclusion>
            <!--                <exclusion>-->
            <!--                    <groupId>com.hazelcast</groupId>-->
            <!--                    <artifactId>hazelcast</artifactId>-->
            <!--                </exclusion>-->
        </exclusions>
    </dependency>
  <!--        <dependency>-->
  <!--            <groupId>com.hazelcast</groupId>-->
  <!--            <artifactId>hazelcast-all</artifactId>-->
  <!--            <version>3.9</version>-->
  <!--        </dependency>-->
    <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-transport-native-epoll</artifactId>
        <classifier>linux-x86_64</classifier>
    </dependency>      
   </dependencies>

我得到的错误如下:

Caused by: java.lang.ClassNotFoundException: com.hazelcast.core.MembershipListener

如您在我的 pom.xml 中所见,我还添加了依赖项 hazelcast-all:3.9 并从 vertx-hazelcast:3.9.2 中排除了 hazelcast 依赖项,然后此错误消失但出现另一个错误:

Caused by: com.hazelcast.config.InvalidConfigurationException: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://www.hazelcast.com/schema/config":memcache-protocol}'. One of '{"http://www.hazelcast.com/schema/config":public-address, "http://www.hazelcast.com/schema/config":reuse-address, "http://www.hazelcast.com/schema/config":outbound-ports, "http://www.hazelcast.com/schema/config":join, "http://www.hazelcast.com/schema/config":interfaces, "http://www.hazelcast.com/schema/config":ssl, "http://www.hazelcast.com/schema/config":socket-interceptor, "http://www.hazelcast.com/schema/config":symmetric-encryption, "http://www.hazelcast.com/schema/config":member-address-provider}' is expected.

我是不是做错了什么或忘记了什么,或者这只是 Quarkus 或 Vertx 中的错误?

提前感谢任何帮助。

最佳答案

我认为您的问题最可能的原因是您使用的 quarkus-universe-bom 强制执行与 vertx-hazelcast.

使用 mvn dependency:tree 检查你的依赖树,并确保 Hazelcast 工件是 vertx-hazelcast 所需的版本。

另一种选择是简单地使用不强制执行 Hazelcast 版本的 quarkus-bom 并让 vertx-hazelcast 自行拖动依赖项。

关于hazelcast - 在 Quarkus 中配置集群 Vertx Eventbus 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63150170/

相关文章:

java - Mybatis的分布式缓存

java - Vertx Kafka 通过显式轮询自动提交

kotlin - 尝试调用运行阻塞时,带有协同程序的Kotlin Vertx阻塞

java - 在成员变量中使用时注入(inject)的 Bean 未实例化

entitymanager - Quarkus:具有多个数据源的 EntityManager 注入(inject)

java - Hazelcast - 为什么入门处理器不使用可移植?

java - Hazelcast 终止用户 session

java - Hazelcast 中的分布式读写锁

java - 如何使用vertx执行跨源GET请求?

java - 如何在 Quarkus 扩展中注入(inject)配置属性