Author Archives: Robins

[Solved] fasterxml ToStringSerializerBase Error: Caused by: java.lang.NoClassDefFoundError…

Tostringserializerbase reports an error

Error content

Integration Dubbo times error

Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ser/std/ToStringSerializerBase
	at com.fasterxml.jackson.datatype.jsr310.JavaTimeModule.<init>(JavaTimeModule.java:158) ~[jackson-datatype-jsr310-2.13.2.jar:2.13.2]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_322]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_322]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_322]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_322]
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.18.jar:5.3.18]
	... 69 common frames omitted

reason

Dubbo dependency needs the support of fasterxml

        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-spring-boot-starter</artifactId>
            <version>3.0.7</version>
        </dependency>

        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-rpc-dubbo</artifactId>
            <version>3.0.7</version>
        </dependency>

        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-registry-zookeeper</artifactId>
            <version>3.0.7</version>
        </dependency>

solve

Add dependency

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.10.1</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.10.1</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.10.1</version>
        </dependency>

Complete dependency

    <dependencies>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.10.1</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.10.1</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.10.1</version>
        </dependency>


        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-spring-boot-starter</artifactId>
            <version>3.0.7</version>
        </dependency>

        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-rpc-dubbo</artifactId>
            <version>3.0.7</version>
        </dependency>

        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-registry-zookeeper</artifactId>
            <version>3.0.7</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>2.6.6</version>
        </dependency>

        <dependency>
            <groupId>org.example</groupId>
            <artifactId>common</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

    </dependencies>

 

[Solved] Vue3 Error: Failed to resolve component:xxx

I use vite+typescript+pinia to develop the vue3 project, because I have just come into contact with this problem recently. Look at the code first:

<script lang="ts" setup name="XtxMore">
</script>
<template>
  <RouterLink
    to="/"
    class="xtx-more"
  >
    <span>
      <slot>Check All</slot>
    </span>
    <i class="iconfont icon-angle-right"></i>
  </RouterLink>
</template>

At this time, an error will be reported in the console:

This is because when we name the component, that is, when we add the name attribute to the component, there is no content in the script tag, which will lead to the failure of parsing and the error will be reported.

Just add something in the script tag

<script lang="ts" setup name="XtxMore">
defineProps()
</script>
<template>
  <RouterLink class="xtx-more">
    <span>
      <slot>Check All</slot>
    </span>
    <i class="iconfont icon-angle-right"></i>
  </RouterLink>
</template>

 

[Solved] celery Startup Error: kombu.exceptions.VersionMismatch: Redis transport requires redis-py versions 3.2.0 or later. You have 2.10.6

Error when starting celery:

kombu.exceptions.VersionMismatch: Redis transport requires redis-py versions 3.2.0 or later. You have 2.10.6

The reason is that my redis version is too low and incompatible with kombu. But I won’t touch my redis
uninstall the current celery, download the 4.1.0 version of celery (kombu will be updated during installation), and then start it again. An error is reported:

pip install Celery==4.1.0
error:
KeyError: 'async'

The problem is that version 4.1.0 of celery is incompatible with python3.6.9, so replace it with version 4.1.1 of celery

pip install Celery==4.1.0

Start celery again:

celery -A celery_task.main worker -l info

Done!

 

[Solved] Fluent error: invalid command [initialize-flow

Fluent error reporting record

1. invalid command [initialize-flow

. Two files are needed to calculate fluent on the cluster, *.jou and *.cas;
In *.jou, you can input and output file information and execute commands

/file/read-case *.cas
/solve/initialize/initialize-flow 
/solve/iterate 10000
/file/write-data out.dat
exit
yes

Job script, take LSF as an example *.lsf:

#!/bin/sh
APP_NAME=fluent
NP=12
NP_PER_NODE=12
RUN="fluent 3d -g -i input.jou"

Error 1 after submission:

Solution: Check the format of input.jou file, type: set ff after vim, see whether the file is in dos format or unix format, the problem I encountered on my side was caused by the wrong format, and the calculation was normal after changing to unix format.

[Solved] Linux Calls mmap Error: mmap: Invalid argument

Background

When using shared memory on Linux, the most common way is to use MMAP mapping file: a few days ago, when writing a program, there was an error in the execution of MMAP:

./test_mmap tmp.txt
mmap: Invalid argument

The procedure is as follows:

#include <stdio.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>

int main(int argc, char **argv)
{
    int fd;
    struct stat sb;
    char *mmapped;

    if (argc != 2) {
        return -1;
    }

    fd = open(argv[1], O_RDWR);
    if(fd < 0) {
        perror("open");
        return -1;
    }

    if(fstat(fd, &sb) == -1) {
        perror("fstat");
        return -1;
    }

    mmapped = mmap(NULL, sb.st_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
    if (mmapped == MAP_FAILED) {
        perror("mmap");
        return -1;
    }

    close(fd);

    mmapped[0] = '1';

    if(msync((void*)mmapped, sb.st_size, MS_SYNC) == -1) {
        perror("msync");
        return -1;
    }

    munmap((void *)mmapped, sb.st_size);

    return 0;
}

I have encountered this problem before, but I forgot what happened and took a little time to find the reason. In order to avoid repeating the mistakes, write an article and record it.

reason

On my environment, the reason for this error is that the mmap mapped file is not on the local machine! My Ubuntu is in a virtual machine, and the host is macOS. A folder on the host is shared to the virtual machine, and it is in this shared folder that the mmap file is in when I execute the program, so this strange error is reported.

[Solved] jooq Customize GeneratorStrategy Error: ClassNotFoundException

Problem description

tip: describe the problems encountered in the project here:

Gradle (kotlin project)

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jooq.codegen.GenerationTool
import org.jooq.meta.jaxb.*

plugins {
    id("org.springframework.boot") version "2.7.1"
    id("io.spring.dependency-management") version "1.0.11.RELEASE"
    kotlin("jvm") version "1.6.21"
    kotlin("plugin.spring") version "1.6.21"

}

group = "com.nova"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_1_8

repositories {
    mavenCentral()
}

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath("org.jooq:jooq-codegen:3.14.7")
        classpath("mysql:mysql-connector-java:8.0.29")
    }
}


dependencies {

    implementation("org.springframework.boot:spring-boot-starter-jooq")
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    runtimeOnly("mysql:mysql-connector-java:8.0.29")
    testImplementation("org.springframework.boot:spring-boot-starter-test")
    implementation("org.jooq:jooq:3.14.7")
    implementation("org.jooq:jooq-meta:3.14.7")
    implementation("org.jooq:jooq-codegen:3.14.7")

}

tasks.register("JOOQ_Code_Generate") {
    doLast{
        val config: org.jooq.meta.jaxb.Configuration = Configuration()
            .withJdbc(Jdbc()
                .withDriver("com.mysql.cj.jdbc.Driver")
                .withUrl("jdbc:mysql://127.0.0.1:3306/learn-jooq?characterEncoding=UTF-8&serverTimezone=GMT")
                .withUsername("root")
                .withPassword("root"))
            .withGenerator(Generator()
                    //default is java
                .withName("org.jooq.codegen.KotlinGenerator")
                .withGenerate(Generate()
                    .withComments(true) 
                    .withCommentsOnCatalogs(true)
                    .withRelations(true)
                    .withImmutablePojos(false) // if true, cannot use 'into()' method
                    .withInterfaces(true)
                    .withDaos(true))
                .withDatabase(Database()
                    .withName("org.jooq.meta.mysql.MySQLDatabase")
                    .withIncludes("s.*")
                    .withInputSchema("learn-jooq")
                )
                .withTarget(org.jooq.meta.jaxb.Target()
                    .withPackageName("com.nova.novademo.codegen")
                    .withDirectory("src/main/kotlin"))
                .withStrategy(Strategy() //Customized generation policy, error reporting
                    .withName("com.nova.novademo.CustomGeneratorStrategy")
//                    .withName("org.jooq.codegen.DefaultGeneratorStrategy")
                )
            )
        GenerationTool.generate(config)
    }
}


tasks.withType<KotlinCompile> {
    kotlinOptions {
        freeCompilerArgs = listOf("-Xjsr305=strict")
        jvmTarget = "1.8"
    }
}

tasks.withType<Test> {
    useJUnitPlatform()
}

Maven (Java project)

<?xml version="1.0" encoding="UTF-8"?>
<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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.4</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.lzy</groupId>
    <artifactId>JOOQ</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>JOOQ</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jooq</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jooq</groupId>
            <artifactId>jooq-meta</artifactId>
            <version>3.14.15</version>
        </dependency>
        <dependency>
            <groupId>org.jooq</groupId>
            <artifactId>jooq-codegen</artifactId>
            <version>3.14.15</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>


            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>


            <!-- jooq code generate plugin-->
            <plugin>

                <groupId>org.jooq</groupId>
                <artifactId>jooq-codegen-maven</artifactId>
                <version>${jooq.version}</version>
                
                <configuration>
                    <jdbc>
                        <driver>com.mysql.cj.jdbc.Driver</driver>
                        <url>jdbc:mysql://127.0.0.1:3306/learn-jooq?serverTimezone=GMT%2B8</url>
                        <user>root</user>
                        <password>root</password>
                    </jdbc>
                    <generator>
                        <strategy>
                            <name>com.lzy.jooq.CustomGeneratorStrategy</name>
                        </strategy>
                        <generate>
                            <pojos>true</pojos>
                            <daos>true</daos>
                        </generate>
                        <database>
                            <includes>s.*</includes>
                            <inputSchema>learn-jooq</inputSchema>
                        </database>
                        <target>
                            <packageName>com.lzy.jooq.codegen</packageName>
                            <directory>/src/main/java</directory>
                        </target>
                    </generator>
                </configuration>
            </plugin>

        </plugins>
    </build>

</project>

Cause analysis:

After specifying the GeneratorStrategy as a custom CustomGeneratorStrategy, an error ClassNotFoundException is reported.


Solution:

You can compile or run it first, as long as you generate the corresponding .class file under the target file.

[Solved] nacos Startup Error: Please set the JAVA_HOME variable in your environment

Nacos is registered as a service in centos7, but it cannot be started

report errors

Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better!

reason

The java and javac of the installed JDK are not in the nacos startup script startup.sh (mine is under /opt/java/jdk1.8.0_333/)

terms of settlement

Add Java path to startup.sh

[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/opt/java/jdk1.8.0_333

Restart the service successfully

[Solved] MVN Build Project Error: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test

Error Messages:

Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test

[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ wls-exporter-core ---
Oct 16, 2021 7:34:54 AM org.sonatype.guice.bean.reflect.Logs$JULSink warn
WARNING: Error injecting: org.apache.maven.plugin.surefire.SurefirePlugin
com.google.inject.ProvisionException: Guice provision errors:

1) No implementation for org.codehaus.plexus.languages.java.jpms.LocationManager was bound.
  while locating org.apache.maven.plugin.surefire.SurefirePlugin

1 error
        at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1006)
        at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1032)
        at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:45)
        at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
        at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55)
        at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
        at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
        at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:138)
        at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:109)
        at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
        at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
        at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
        at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:997)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1047)
        at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:993)
        at com.google.inject.Scopes$1$1.get(Scopes.java:59)
        at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:83)
        at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:49)
        at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:253)
        at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:245)
        at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:455)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:414)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357)

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.410s
[INFO] Finished at: Sat Oct 16 07:34:54 UTC 2021
[INFO] Final Memory: 21M/154M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project wls-exporter-core: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test failed: Unable to load the mojo 'test' (or one of its required components) from the plugin 'org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5': com.google.inject.ProvisionException: Guice provision errors:
[ERROR]
[ERROR] 1) No implementation for org.codehaus.plexus.languages.java.jpms.LocationManager was bound.
[ERROR] while locating org.apache.maven.plugin.surefire.SurefirePlugin
[ERROR] at ClassRealm[plugin>org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5, parent: sun.misc.Launcher$AppClassLoader@7852e922]
[ERROR] while locating org.apache.maven.plugin.Mojo annotated with @com.google.inject.name.Named(value=org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test)
[ERROR]
[ERROR] 1 error
[ERROR] role: org.apache.maven.plugin.Mojo
[ERROR] roleHint: org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test

Solution

Upgrade maven to the latest version

Reference:
https://stackoverflow.com/questions/53211941/unable-to-load-the-mojo-test-org-apache-maven-pluginsmaven-surefire-plugin

Error message
maven plugin failed to parse: Could not transfer artifact XXX, transfer failed for XXX
Solution:
Finally add this to the maven parameters to solve the certificate problem on the line.
-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true

[Solved] webpack Package Error: ERROR in multi ./src/main.js ./dist/bundle.js Module not found: Error: Can‘t resolv

When I first came into contact with webpack, I encountered several problems. After successfully installing the latest version of webpack and cli, there was a problem with the first package. In fact, it was also a syntax error

When running webpack .\src\main.js .\dist\bundle.js and packaging, the following error occurs:

Cause of error:

The latest version of the webpack command has changed

Solution:

Add a -o to the previous command.
run webpack .\src\main.js -o .\dist\bundle.js

[Solved] prometheus Exception Exit Error: opening storage failed

The abnormal exit log of Prometheus is as follows:

Solution:

1. Enter the Prometheus data directory, remove the error folder, and the log after restart is as follows:

ts=2022-06-30T03:52:56.187Z caller=manager.go:956 level=info component="rule manager" msg="Rule manager stopped"
ts=2022-06-30T03:52:56.187Z caller=notifier.go:600 level=info component=notifier msg="Stopping notification manager..."
ts=2022-06-30T03:52:56.187Z caller=main.go:1068 level=info msg="Notifier manager stopped"
ts=2022-06-30T03:52:56.187Z caller=main.go:1077 level=error err="opening storage failed: reloadBlocks: 15 errors: corrupted block 01G2XWKD8X0VPKWNJGN5YE64E7: read symbols: invalid checksum; corrupted block 01G3E6EMA9NMC5P3GEASJD7A4H: invalid magic number 0; corrupted block 01G1TFMH0WD2YXH0GJ9D86QKFY: invalid magic number 0; corrupted block 01G22VDVS27547SZ1BRMG8R4JY: invalid magic number 0; corrupted block 01G3VG5NRWAVJ8WGN0PZ2T5TAH: read symbols: invalid checksum; corrupted block 01G548SQ8V8YFVCR5XP3XS6GGW: read symbols: invalid checksum; corrupted block 01G313KA0WPYMK53APAPGGQ3RD: read symbols: invalid checksum; corrupted block 01G361H0RV5HA7ZMJA37GJJ605: invalid magic number 0; corrupted block 01G36P4714CSMRBZJMV5XV2W63: read symbols: invalid checksum; corrupted block 01G3X07RGVREACT0YTJP3HMVH2: read symbols: invalid checksum; corrupted block 01G578XWRW3E0VSY0X35FMMDPD: read symbols: invalid checksum; corrupted block 01G32CSNGWD0SAFSDF2HSXT6J5: read symbols: invalid checksum; corrupted block 01G37AQC8WVV2AWQNZWNF05WYA: read symbols: invalid checksum; corrupted block 01G386698WS46Q9566K0X9VX25: invalid magic number 0; corrupted block 01G4A9YT0WJDKKWEM33B017D0T: read symbols: invalid checksum"

2. Remove all error blocks in the log

$ mv 01G313KA0WPYMK53APAPGGQ3RD 01G361H0RV5HA7ZMJA37GJJ605 01G36P4714CSMRBZJMV5XV2W63 01G3X07RGVREACT0YTJP3HMVH2 01G578XWRW3E0VSY0X35FMMDPD 01G32CSNGWD0SAFSDF2HSXT6J5 01G37AQC8WVV2AWQNZWNF05WYA 01G386698WS46Q9566K0X9VX25 01G4A9YT0WJDKKWEM33B017D0T bak/

3. Start again successfully.

ts=2022-06-30T03:56:12.892Z caller=db.go:1157 level=error component=tsdb msg="Failed to read meta.json for a block during reloadBlocks. Skipping" dir=/data/01G313KA0WPYMK53APAPGGQ3RD err="open /data/01G313KA0WPYMK53APAPGGQ3RD/meta.json: no such file or directory"
ts=2022-06-30T03:56:13.355Z caller=db.go:1157 level=error component=tsdb msg="Failed to read meta.json for a block during reloadBlocks. Skipping" dir=/data/01G32CSNGWD0SAFSDF2HSXT6J5 err="open /data/01G32CSNGWD0SAFSDF2HSXT6J5/meta.json: no such file or directory"
ts=2022-06-30T03:56:15.150Z caller=db.go:1157 level=error component=tsdb msg="Failed to read meta.json for a block during reloadBlocks. Skipping" dir=/data/01G361H0RV5HA7ZMJA37GJJ605 err="open /data/01G361H0RV5HA7ZMJA37GJJ605/meta.json: no such file or directory"
ts=2022-06-30T03:56:15.381Z caller=db.go:1157 level=error component=tsdb msg="Failed to read meta.json for a block during reloadBlocks. Skipping" dir=/data/01G36P4714CSMRBZJMV5XV2W63 err="open /data/01G36P4714CSMRBZJMV5XV2W63/meta.json: no such file or directory"
ts=2022-06-30T03:56:15.641Z caller=db.go:1157 level=error component=tsdb msg="Failed to read meta.json for a block during reloadBlocks. Skipping" dir=/data/01G37AQC8WVV2AWQNZWNF05WYA err="open /data/01G37AQC8WVV2AWQNZWNF05WYA/meta.json: no such file or directory"
ts=2022-06-30T03:56:16.006Z caller=db.go:1157 level=error component=tsdb msg="Failed to read meta.json for a block during reloadBlocks. Skipping" dir=/data/01G386698WS46Q9566K0X9VX25 err="open /data/01G386698WS46Q9566K0X9VX25/meta.json: no such file or directory"
ts=2022-06-30T03:56:26.474Z caller=db.go:1157 level=error component=tsdb msg="Failed to read meta.json for a block during reloadBlocks. Skipping" dir=/data/01G3X07RGVREACT0YTJP3HMVH2 err="open /data/01G3X07RGVREACT0YTJP3HMVH2/meta.json: no such file or directory"
ts=2022-06-30T03:56:33.312Z caller=db.go:1157 level=error component=tsdb msg="Failed to read meta.json for a block during reloadBlocks. Skipping" dir=/data/01G4A9YT0WJDKKWEM33B017D0T err="open /data/01G4A9YT0WJDKKWEM33B017D0T/meta.json: no such file or directory"
ts=2022-06-30T03:56:46.171Z caller=db.go:1157 level=error component=tsdb msg="Failed to read meta.json for a block during reloadBlocks. Skipping" dir=/data/01G578XWRW3E0VSY0X35FMMDPD err="open /data/01G578XWRW3E0VSY0X35FMMDPD/meta.json: no such file or directory"
ts=2022-06-30T03:57:08.413Z caller=head.go:493 level=info component=tsdb msg="Replaying on-disk memory mappable chunks if any"
ts=2022-06-30T03:57:35.681Z caller=head.go:520 level=error component=tsdb msg="Loading on-disk chunks failed" err="iterate on on-disk chunks: corruption in head chunk file /data/chunks_head/001701: checksum mismatch expected:00000000, actual:cfead048"
ts=2022-06-30T03:57:35.684Z caller=head.go:689 level=info component=tsdb msg="Deleting mmapped chunk files"
ts=2022-06-30T03:57:35.764Z caller=head.go:699 level=info component=tsdb msg="Deletion of mmap chunk files successful, reattempting m-mapping the on-disk chunks"
ts=2022-06-30T03:57:35.869Z caller=head.go:536 level=info component=tsdb msg="On-disk memory mappable chunks replay completed" duration=27.456523956s
ts=2022-06-30T03:57:35.869Z caller=head.go:542 level=info component=tsdb msg="Replaying WAL, this may take a while"
ts=2022-06-30T03:58:34.193Z caller=head.go:578 level=info component=tsdb msg="WAL checkpoint loaded"
ts=2022-06-30T03:58:48.103Z caller=db.go:750 level=warn component=tsdb msg="Encountered WAL read error, attempting repair" err="read records: corruption in segment /data/wal/00003413 at 77221215: snappy: corrupt input"
ts=2022-06-30T03:58:48.103Z caller=wal.go:364 level=warn component=tsdb msg="Starting corruption repair" segment=3413 offset=77221215
ts=2022-06-30T03:58:48.455Z caller=wal.go:372 level=warn component=tsdb msg="Deleting all segments newer than corrupted segment" segment=3413
ts=2022-06-30T03:59:54.766Z caller=wal.go:394 level=warn component=tsdb msg="Rewrite corrupted segment" segment=3413
ts=2022-06-30T04:00:44.492Z caller=main.go:958 level=info fs_type=65735546
ts=2022-06-30T04:00:44.492Z caller=main.go:961 level=info msg="TSDB started"

 

[Solved] Spring Kafka Send Error in specifies partition: Topic radar not present in metadata after 60000

Error Messages;
org.apache.kafka.common.errors.TimeoutException: Topic radar not present in metadata after 60000 ms.

2022-06-27 16:31:22.734 ERROR 11236 --- [  XNIO-1 task-1] o.s.k.support.LoggingProducerListener    : Exception thrown when sending a message with key='radar-statistics-data-0' and payload='{"time":"2022-6-27 16:27:56","index":0,"id":16563186227240,"type":"statistics data"}' to topic radar and partition 3:

org.apache.kafka.common.errors.TimeoutException: Topic radar not present in metadata after 60000 ms.

2022-06-27 16:31:22.737 ERROR 11236 --- [  XNIO-1 task-1] c.n.radar.web.rest.RadarKafkaResource    : Exception in testKafka() with cause = 'org.apache.kafka.common.errors.TimeoutException: Topic radar not present in metadata after 60000 ms.' and exception = 'Send failed; nested exception is org.apache.kafka.common.errors.TimeoutException: Topic radar not present in metadata after 60000 ms.'

org.springframework.kafka.KafkaException: Send failed; nested exception is org.apache.kafka.common.errors.TimeoutException: Topic radar not present in metadata after 60000 ms.
	at org.springframework.kafka.core.KafkaTemplate.doSend(KafkaTemplate.java:666)
	at org.springframework.kafka.core.KafkaTemplate.send(KafkaTemplate.java:429)
	at com.newatc.collect.config.KafkaProducer.sendProducerRecord(KafkaProducer.java:66)
	at com.newatc.radar.web.rest.RadarKafkaResource.testKafka(RadarKafkaResource.java:95)
	at com.newatc.radar.web.rest.RadarKafkaResource$$FastClassBySpringCGLIB$$56927135.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
	at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:64)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
	at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89)
	at com.newatc.radar.aop.logging.LoggingAspect.logAround(LoggingAspect.java:103)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:634)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:624)
	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:72)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
	at com.newatc.radar.web.rest.RadarKafkaResource$$EnhancerBySpringCGLIB$$14f2a630.testKafka(<generated>)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:497)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:584)
	at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
	at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126)
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
	at org.springframework.security.oauth2.client.web.OAuth2AuthorizationCodeGrantFilter.doFilterInternal(OAuth2AuthorizationCodeGrantFilter.java:168)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
	at org.springframework.security.oauth2.server.resource.web.BearerTokenAuthenticationFilter.doFilterInternal(BearerTokenAuthenticationFilter.java:121)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
	at org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestRedirectFilter.doFilterInternal(OAuth2AuthorizationRequestRedirectFilter.java:178)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103)
	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
	at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)
	at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
	at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)
	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
	at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
	at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
	at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
	at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
	at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)
	at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
	at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
	at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
	at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:119)
	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:275)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:79)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:134)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:131)
	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
	at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:255)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:79)
	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:100)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:387)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:852)
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2019)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1558)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1449)
	at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1280)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.apache.kafka.common.errors.TimeoutException: Topic radar not present in metadata after 60000 ms.

Solution:

  • First check whether there is no such topic. There is no such topic in kafka at the beginning, but I set it in the yml configuration file, so that no error will be reported when spring.kafka.listener.missing-topics-fatalis set to false, but the topic will be created automatically
  • I checked the kafka configuration file server.properties and found that the kafka configuration parameter sets the number of partitions to 1 ( num.partitions=1), when a topic is created by default, only one partitioned topic will be created
  • In the code, data is sent to partitions other than partition 0, but this partition cannot be found, so an error is reported
  • Partitions can be created manually in the command window kafka-topics --bootstrap-server localhost:9092 --create --topic radar --partitions 3 --replication-factor 1
  • Or create NewTopic with @Bean

 

    /**
     * When the project starts, the topic is created automatically, specifying the number of partitions and copies
     * @return Topic
     */
    @Bean
    public NewTopic topic(){
        return new NewTopic(topic, patitions, replications);
    }