java.lang.NoClassDefFoundError: no se pudo inicializar la clase org.rocksdb.Options en Windows 10

Estoy tratando de ejecutar un microservicio como una aplicación de arranque de primavera que depende de RocksDB. Actualmente estoy atrapado recibiendo una excepción a continuación.

Entorno: Windows 10 v.1809 OpenJDK 10.2 Sistema de compilación - Maven 3.6 InteliJ Idea 2018.3.1 RocksDB:

<dependency>
     <groupId>org.rocksdb</groupId>
     <artifactId>rocksdbjni</artifactId>
     <version>5.17.2</version>
</dependency>

Kafka (2.0) y Zookeeper se están ejecutando en el contenedor Docker.

Después de que se inicia el servicio, se lanza una excepción para cada hilo kafka:

Excepción en el hilo "thread" java.lang.NoClassDefFoundError: No se pudo inicializar la clase org.rocksdb.Options en org.apache.kafka.streams.state.internals.RocksDBStore.openDB (RocksDBStore.java:128) en org.apache.kafka .streams.state.internals.RocksDBStore.init (RocksDBStore.java:185) en org.apache.kafka.streams.state.internals.ChangeLoggingKeyValueBytesStore.init (ChangeLoggingKeyValueBytesStore.java:40) en org.apaches.kaf.kapache.ka .internals. .init (MeteredKeyValueBytesStore.java:104) en org.apache.kafka.streams.processor.internals.AbstractTask.registerStateStores (AbstractTask.java:225) en org.apache.kafka.streams.processor.internals.StreamTask.initializeStateStores (StreamTask.java:159) en org.apache.kafka.streams.processor.internals.AssignedTasks.asitksizeTasks. java: 123) en org.apache.kafka.streams.processor.internals.TaskManager.updateNewAndRestoringTasks (TaskManager.java:250) en org.apache.kafka.streams.processor.internals.StreamThread.runOnce (StreamThread.java:810) en org.apache.kafka.streams.processor.internals.StreamThread.runLoop (StreamThread.java:771) en org.apache.kafka.streams.processor.internals.StreamThread.run (StreamThread.java:741)AssignedTasks.initializeNewTasks (AssignedTasks.java:123) en org.apache.kafka.streams.processor.internals.TaskManager.updateNewAndRestoringTasks (TaskManager.java:250) en org.apache.kafka.streams.processor.Ttern.rcess.r. StreamThread.java:810) en org.apache.kafka.streams.processor.internals.StreamThread.runLoop (StreamThread.java:771) en org.apache.kafka.streams.processor.internals.StreamThread.run (StreamThread.java: 741)AssignedTasks.initializeNewTasks (AssignedTasks.java:123) en org.apache.kafka.streams.processor.internals.TaskManager.updateNewAndRestoringTasks (TaskManager.java:250) en org.apache.kafka.streams.processor.Ttern.rcess.r. StreamThread.java:810) en org.apache.kafka.streams.processor.internals.StreamThread.runLoop (StreamThread.java:771) en org.apache.kafka.streams.processor.internals.StreamThread.run (StreamThread.java: 741)internals.StreamThread.run (StreamThread.java:741)internals.StreamThread.run (StreamThread.java:741)

He tratado de usar algunas versiones anteriores de RocksDB que comienzan con 4.9. Establezca la variable de entorno ROCKSDB_SHAREDLIB_DIR manualmente.

¿Podría alguien compartir alguna idea de lo que está mal y cómo se puede solucionar?

[ UPD ] Agregué un archivo pom padre del servidor y un archivo pom hijo del servicio que intento ejecutar.

Servidor :

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="http://maven.apache.org/POM/4.0.0"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>group</groupId>
<artifactId>server</artifactId>
<version>0.13.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>name</name>

<!-- Global Properties -->
<properties>
    <spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
    <spring-boot.version>2.0.5.RELEASE</spring-boot.version>

    <!-- Maven Properties -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.outputEncoding>UTF-8</project.build.outputEncoding>

    <!-- Maven Plugin Versions -->
    <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
    <maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>

    <!-- Standard Dependency Versions -->
    <commons-collections.version>3.2.2</commons-collections.version>
    <commons-io.version>2.5</commons-io.version>
    <guava.version>21.0</guava.version>
    <hibernate-enhance-plugin.version>5.3.6.Final</hibernate-enhance-plugin.version>
    <hibernate-ehcache.version>5.3.6.Final</hibernate-ehcache.version>
    <hibernate-core.version>5.3.6.Final</hibernate-core.version>
    <java.version>10</java.version>
    <jms.version>2.0.1</jms.version>
    <log4j.version>2.8.2</log4j.version>
    <activemq.version>5.15.4</activemq.version>
    <activemq-core.version>5.7.0</activemq-core.version>
    <javax.inject.version>1</javax.inject.version>
    <json-patch.version>1.9</json-patch.version>
    <keycloak.version>4.3.0.Final</keycloak.version>
    <jaxb.version>2.3.0</jaxb.version>
    <liquibase.version>3.5.3</liquibase.version>
    <postgresql.version>42.1.1</postgresql.version>

    <!-- Standard Testing Versions -->
    <jacoco.version>0.7.9</jacoco.version>
    <junit.version>5.2.0</junit.version>
    <mockito.version>2.21.0</mockito.version>
    <maven-surefire-plugin.version>2.22.0</maven-surefire-plugin.version>

    <!-- Code-generating Tool Versions -->
    <org.mapstruct.version>1.2.0.Final</org.mapstruct.version>
    <org.projectlombok.version>1.18.0</org.projectlombok.version>

    <!-- Kafka Properties -->
    <spring-cloud-stream-binder-kafka.version>2.0.1.RELEASE</spring-cloud-stream-binder-kafka.version>

</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven-compiler-plugin.version}</version>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${maven-javadoc-plugin.version}</version>
            <executions>
                <execution>
                    <id>aggregate</id>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                    <phase>site</phase>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>${jacoco.version}</version>
            <executions>
                <execution>
                    <id>default-prepare-agent</id>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>default-report</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven-surefire-plugin.version}</version>
            <configuration>
                <forkCount>4</forkCount>
                <reuseForks>true</reuseForks>
                <argLine>-Xmx2048m</argLine>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <!-- Common Dependencies -->
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>${guava.version}</version>
    </dependency>
    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>${commons-collections.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>${commons-io.version}</version>
    </dependency>
    <dependency>
        <groupId>io.micrometer</groupId>
        <artifactId>micrometer-core</artifactId>
    </dependency>
    <dependency>
        <groupId>com.squareup.okhttp3</groupId>
        <artifactId>okhttp</artifactId>
    </dependency>

    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>${jaxb.version}</version>
    </dependency>

    <dependency>
        <groupId>org.glassfish.jaxb</groupId>
        <artifactId>jaxb-runtime</artifactId>
        <version>${jaxb.version}</version>
    </dependency>

    <dependency>
        <groupId>org.mapstruct</groupId>
        <artifactId>mapstruct-processor</artifactId>
        <version>${org.mapstruct.version}</version>
        <scope>provided</scope>
    </dependency>
    <!-- Spring Cloud Dependencies -->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-commons</artifactId>
    </dependency>

    <!-- Jackson JSON Dependencies -->
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.datatype</groupId>
        <artifactId>jackson-datatype-jsr310</artifactId>
        <exclusions>
            <exclusion>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <!-- Json Patch support -->
    <dependency>
        <groupId>com.github.fge</groupId>
        <artifactId>json-patch</artifactId>
        <version>${json-patch.version}</version>
    </dependency>

    <!-- Testing Dependencies -->
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.junit.vintage</groupId>
        <artifactId>junit-vintage-engine</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-junit-jupiter</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <!-- Exclude JUnit 4 from starter-test (and all other related test-starter, i.e
             those for security and project reactor -->
        <exclusions>
            <exclusion>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <!-- Spring Cloud Dependencies -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <!-- Spring Boot Dependencies -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>${spring-boot.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <!-- Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate-core.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-ehcache</artifactId>
            <version>${hibernate-ehcache.version}</version>
        </dependency>
    </dependencies>
</dependencyManagement>

Servicio :

<?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 
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
    <artifactId>server</artifactId>
    <groupId>group</groupId>
    <version>0.13.1-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>service</artifactId>
<name>service</name>
<packaging>jar</packaging>

<!-- Global Properties -->
<properties>
    <!-- Traffic Control Properties -->
    <tc.build.version>${maven.build.timestamp}</tc.build.version>

    <!-- Maven Properties -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.outputEncoding>UTF-8</project.build.outputEncoding>

    <!-- Spring Boot Properties -->
    <start-class>ServiceApplication</start-class>
    <spring-cloud-stream-binder-kafka.version>2.0.1.RELEASE</spring-cloud-stream-binder-kafka.version>

    <!-- Kafka Properties -->
    <kafka-streams-test-utils.version>2.0.0</kafka-streams-test-utils.version>

    <!-- Cache Properties -->
    <ehcache.version>2.10.4</ehcache.version>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <compilerVersion>${java.version}</compilerVersion>
                <source>${java.version}</source>
                <target>${java.version}</target>
                <compilerArgs>
                    <compilerArg>
                        <!-- The MapStruct property forces to create component from generated mapper to look up in Spring IoC container -->
                        -Amapstruct.defaultComponentModel=spring
                    </compilerArg>
                    <compilerArg>
                        <!-- The MapStruct property forces to create component from generated mapper to look up in Spring IoC container -->
                        -Amapstruct.unmappedTargetPolicy=ERROR
                    </compilerArg>
                </compilerArgs>
                <annotationProcessorPaths>
                    <path>
                        <!-- Custom AccessorNamingStrategy SPI implementation -->
                        <groupId>group</groupId>
                        <artifactId>core-lib</artifactId>
                        <version>${project.parent.version}</version>
                    </path>
                    <path>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                        <version>${org.projectlombok.version}</version>
                    </path>
                    <path>
                        <groupId>org.mapstruct</groupId>
                        <artifactId>mapstruct-processor</artifactId>
                        <version>${org.mapstruct.version}</version>
                    </path>
                </annotationProcessorPaths>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
                <execution>
                    <id>aggregate</id>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                    <phase>site</phase>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>${spring-boot.version}</version>
            <configuration>
                <executable>true</executable>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<dependencies>
    <!-- Dropwizard Metrics + Prometheus Dependencies -->
    <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-core</artifactId>
    </dependency>
    <dependency>
        <groupId>io.micrometer</groupId>
        <artifactId>micrometer-registry-prometheus</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aspects</artifactId>
    </dependency>

    <!-- Spring Boot Dependencies -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>${spring-boot.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-actuator-autoconfigure</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-aop</artifactId>
        <version>${spring-boot.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jersey</artifactId>
        <version>${spring-boot.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-log4j2</artifactId>
        <version>${spring-boot.version}</version>
    </dependency>
    <dependency>
            <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
        <version>${spring-boot.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-cache</artifactId>
        <version>${spring-boot.version}</version>
    </dependency>

    <!-- Spring Framework Dependencies -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
    </dependency>

    <!-- Spring Integration Dependencies -->
    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-jms</artifactId>
    </dependency>

    <!-- Spring Cloud Dependencies -->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-sleuth</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-zipkin</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        <exclusions>
            <exclusion>
                <groupId>javax.ws.rs</groupId>
                <artifactId>jsr311-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <!-- Spring Cloud Stream -->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-stream-binder-kafka</artifactId>
        <version>${spring-cloud-stream-binder-kafka.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-stream-binder-kafka-streams</artifactId>
        <version>${spring-cloud-stream-binder-kafka.version}</version>
        <exclusions>
            <exclusion>
                <artifactId>rocksdbjni</artifactId>
                <groupId>org.rocksdb</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.rocksdb</groupId>
        <artifactId>rocksdbjni</artifactId>
        <version>5.17.2</version>
    </dependency>


    <!-- Keycloak Dependencies -->
    <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-spring-boot-starter</artifactId>
        <version>${keycloak.version}</version>
    </dependency>
    <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-spring-security-adapter</artifactId>
        <version>${keycloak.version}</version>
    </dependency>
    <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-spring-boot-starter</artifactId>
        <version>${keycloak.version}</version>
    </dependency>
    <dependency>
        <groupId>org.keycloak.bom</groupId>
        <artifactId>keycloak-adapter-bom</artifactId>
        <version>${keycloak.version}</version>
        <type>pom</type>
    </dependency>

    <!-- Testing Dependencies -->
    <dependency>
        <groupId>org.jacoco</groupId>
        <artifactId>org.jacoco.agent</artifactId>
        <version>${jacoco.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <version>${spring-boot.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>kafka-streams-test-utils</artifactId>
        <version>${kafka-streams-test-utils.version}</version>
        <scope>test</scope>
    </dependency>

    <!-- Code-generating Tool Dependencies -->
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${org.projectlombok.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.mapstruct</groupId>
        <artifactId>mapstruct-jdk8</artifactId>
        <version>${org.mapstruct.version}</version>
    </dependency>

    <!-- Ehcache Dependencies -->
    <dependency>
        <groupId>net.sf.ehcache</groupId>
        <artifactId>ehcache</artifactId>
        <version>${ehcache.version}</version>
    </dependency>

</dependencies>
</project>

En caso de que la dependencia de RocksDB no esté establecida en el archivo pom, SpingCloud usará alguna versión anterior de RocksDB, 5.7.3, según recuerdo. Y producir la misma excepción.

Respuesta 1

Al parecer, mi problema fue causado por

"java.lang.UnsatisfiedLinkError: Local \ Temp \ librocksdbjni6935746072594020003.dll: No se pueden encontrar bibliotecas dependientes"

que estaba oculto por 15 duplicados de la excepción sobre la que inicialmente pregunté.

El problema se resolvió instalando Microsoft Visual C ++ 2015 Redistributable х64. Tenga en cuenta que el paquete 2015 debe instalarse independientemente de todas las versiones redistribuibles más nuevas que ya tenga.

Respuesta: 2

Suponiendo que tengo un jar ejecutable (A.jar) con archivos .class dentro. También tengo otro jar ejecutable (B.jar) que es lo mismo con A.jar, excepto por los modificadores de acceso que se cambian a público (...

Esta es más una pregunta sobre lo que hay ahí fuera, y las instrucciones futuras sobre la resolución de herramientas como Ivy. ¿Hay algo que pueda mencionar dependencias de nivel de clase para paquetes, en lugar de paquete ...

Estoy tratando de hacer algo relativamente simple. Necesito hacer una solicitud PUT simple con un archivo en el cuerpo para cargar un archivo a un servidor que no esté bajo mi control. Aquí está el código que tengo hasta ahora: ...

Estoy haciendo un desafío de hackernet donde n es una entrada int. Las condiciones son: Si n es impar, imprime Extraño Si n es par y en el rango inclusivo de 2 a 5, imprime No Extraño Si n es par y en el ...