在Quarkus中配置群集Vertx Eventbus时出现问题

时间:2020-07-29 09:09:01

标签: hazelcast vert.x quarkus vertx-eventbus

我正在使用:

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

我无法使混乱的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中的错误?

请提前寻求帮助。

2 个答案:

答案 0 :(得分:3)

我认为,您出现问题的最可能原因是您使用的quarkus-universe-bom强制实施了与vertx-hazelcast不兼容的Hazelcast版本(我们在其中具有Hazelcast扩展名)。

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

另一种选择是只使用quarkus-bom而不强制使用Hazelcast版本,而让vertx-hazelcast自己拖动依赖项。

答案 1 :(得分:0)

似乎是Quarkus中的错误,此问题与以下内容有关:

https://github.com/quarkusio/quarkus/issues/10889

相关问题