javawildflyksqldbjava-ee-8wildfly-26

KSQLDB Java EE Wildfly : NoSuchMethodError on every query


Every time the executeQuery hangs and throws this exception.

I tried this in a project with a simple main() function without Wildfly. It worked there.

test method

public void test() throws ExecutionException, InterruptedException {
  Client client = Client.create(ClientOptions.create()
          .setHost("localhost")
          .setPort(8088));
  
  HashMap<String, Object> props = new HashMap<>();
  
  String sql = "SELECT * FROM SomeTable;";
  
  List<Row> rows = client.executeQuery(sql, props).get();
  
  for(Row row : rows) {
      System.out.println(row);
  }
  
  client.close();
}

error

15:32:06,698 ERROR [io.confluent.shaded.io.vertx.core.impl.ContextBase] (vert.x-eventloop-thread-1) Unhandled exception: java.lang.NoSuchMethodError: 'void io.confluent.ksql.util.VertxUtils.checkContext(io.confluent.shaded.io.vertx.core.Context)'
    at deployment.myproject-1.0.war//io.confluent.ksql.api.client.impl.ResponseHandler.checkContext(ResponseHandler.java:59)
    at deployment.myproject-1.0.war//io.confluent.ksql.api.client.impl.ResponseHandler.handleBodyBuffer(ResponseHandler.java:38)
    at deployment.myproject-1.0.war//io.confluent.ksql.api.client.impl.ExecuteQueryResponseHandler.handleBodyBuffer(ExecuteQueryResponseHandler.java:37)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.parsetools.impl.RecordParserImpl.handleParsing(RecordParserImpl.java:214)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.parsetools.impl.RecordParserImpl.lambda$handler$0(RecordParserImpl.java:316)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:246)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.http.impl.HttpEventHandler.handleEnd(HttpEventHandler.java:76)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.http.impl.HttpClientResponseImpl.handleEnd(HttpClientResponseImpl.java:250)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.http.impl.Http2ClientConnection$StreamImpl.handleEnd(Http2ClientConnection.java:450)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.http.impl.VertxHttp2Stream.lambda$new$1(VertxHttp2Stream.java:63)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:239)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.streams.impl.InboundBuffer.write(InboundBuffer.java:129)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:55)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.impl.ContextBase.emit(ContextBase.java:239)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.http.impl.VertxHttp2Stream.onEnd(VertxHttp2Stream.java:135)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.http.impl.Http2ClientConnection$Stream.onEnd(Http2ClientConnection.java:277)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.http.impl.VertxHttp2Stream.onEnd(VertxHttp2Stream.java:130)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.http.impl.Http2ConnectionBase.onDataRead(Http2ConnectionBase.java:315)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.handler.codec.http2.Http2FrameListenerDecorator.onDataRead(Http2FrameListenerDecorator.java:36)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.handler.codec.http2.Http2EmptyDataFrameListener.onDataRead(Http2EmptyDataFrameListener.java:49)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onDataRead(DefaultHttp2ConnectionDecoder.java:307)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.handler.codec.http2.DefaultHttp2FrameReader.readDataFrame(DefaultHttp2FrameReader.java:415)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:250)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:159)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:173)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.handler.codec.http2.DecoratingHttp2ConnectionDecoder.decodeFrame(DecoratingHttp2ConnectionDecoder.java:63)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:393)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:453)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.vertx.core.http.impl.VertxHttp2ConnectionHandler.channelRead(VertxHttp2ConnectionHandler.java:408)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at deployment.myproject-1.0.war//io.confluent.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:829)

But the method DOES exists because I can call it.

io.confluent.shaded.io.vertx.core.Context context =  ...;
io.confluent.ksql.util.VertxUtils.checkContext(context);

I created a test project: https://github.com/G33RY/testksqldb

I have also opened an issue on Github, but I need this resolved somehow, in the near future not months later. https://github.com/confluentinc/ksql/issues/10018


Solution

  • Okay I found the solution by the help of @William Tatam. He suggested I should use the dependency without the <classifier>with-dependencies</classifier>.

    Then I had to add the other dependencies. I also switched to the confluent repository version 7.4.0.

    Here is my pom.xml

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com</groupId>
        <artifactId>testksqldb</artifactId>
        <version>1.0</version>
        <packaging>war</packaging>
        <name>testksqldb</name>
    
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <ksqldb.version>7.4.0</ksqldb.version>
        </properties>
    
        <repositories>
            <repository>
                <id>ksqlDB</id>
                <name>ksqlDB</name>
                <url>https://ksqldb-maven.s3.amazonaws.com/maven/</url>
            </repository>
            <repository>
                <id>confluent</id>
                <name>Confluent</name>
                <url>https://packages.confluent.io/maven/</url>
            </repository>
        </repositories>
    
        <pluginRepositories>
            <pluginRepository>
                <id>ksqlDB</id>
                <url>https://ksqldb-maven.s3.amazonaws.com/maven/</url>
            </pluginRepository>
        </pluginRepositories>
    
    
        <dependencies>
    
            <dependency>
                <groupId>javax</groupId>
                <artifactId>javaee-api</artifactId>
                <version>8.0</version>
                <scope>provided</scope>
            </dependency>
    
            <dependency>
                <groupId>io.confluent.ksql</groupId>
                <artifactId>ksqldb-api-client</artifactId>
                <version>${ksqldb.version}</version>
            </dependency>
    
            <dependency>
                <groupId>com.fasterxml.jackson.datatype</groupId>
                <artifactId>jackson-datatype-jdk8</artifactId>
                <version>2.14.2</version>
            </dependency>
    
    
            <dependency>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-annotations</artifactId>
                <version>4.7.1</version>
            </dependency>
    
    
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>30.1.1-jre</version>
            </dependency>
    
            <dependency>
                <groupId>io.confluent.ksql</groupId>
                <artifactId>ksqldb-common</artifactId>
                <version>7.4.0</version>
            </dependency>
    
            <dependency>
                <groupId>io.vertx</groupId>
                <artifactId>vertx-core</artifactId>
                <version>4.3.7</version>
            </dependency>
    
    
            <dependency>
                <groupId>io.vertx</groupId>
                <artifactId>vertx-codegen</artifactId>
                <version>4.3.7</version>
            </dependency>
    
    
            <dependency>
                <groupId>org.reactivestreams</groupId>
                <artifactId>reactive-streams</artifactId>
                <version>1.0.3</version>
            </dependency>
    
    
        </dependencies>
    
        <build>
            <sourceDirectory>${basedir}/src</sourceDirectory>
            <resources>
                <resource>
                    <directory>${basedir}/src</directory>
                    <excludes>
                        <exclude>**/*.java</exclude>
                    </excludes>
                </resource>
            </resources>
            <plugins>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>3.4.0</version>
                    <configuration>
                        <warSourceDirectory>${basedir}/WebContent</warSourceDirectory>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                        <source>11</source>
                        <target>11</target>
                        <compilerArgs>
                            <arg>-Xlint:all</arg>
                        </compilerArgs>
                    </configuration>
    
                </plugin>
            </plugins>
        </build>
    </project>