Skip to content
This repository was archived by the owner on Jan 16, 2018. It is now read-only.
This repository was archived by the owner on Jan 16, 2018. It is now read-only.

java.lang.NoClassDefFoundError: Could not initialize class io.netty.util.concurrent.DefaultPromise #22

Description

@juherr
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class io.netty.util.concurrent.DefaultPromise
    at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:35)
    at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:49)
    at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:61)
    at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:52)
    at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:44)
    at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:36)
    at Main.main(Main.java:9)

With:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="debug" strict="true" name="XMLConfigTest">
    <Appenders>
        <Appender type="Console" name="STDOUT"/>
        <GELF name="GrayLog"/>
    </Appenders>
    <Loggers>
        <Root level="trace">
            <AppenderRef ref="STDOUT"/>
        </Root>
    </Loggers>
</Configuration>
<?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">
    <modelVersion>4.0.0</modelVersion>

    <groupId>graylog2-issue</groupId>
    <artifactId>graylog2-issue</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <log4j.version>2.6.2</log4j.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>${log4j.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.graylog2.log4j2</groupId>
            <artifactId>log4j2-gelf</artifactId>
            <version>1.3.0</version>
        </dependency>
    </dependencies>
</project>
import io.netty.channel.nio.NioEventLoopGroup;

import java.net.MalformedURLException;
import java.net.UnknownHostException;

public class Main {

    public static void main(String... args) throws UnknownHostException, MalformedURLException {
        NioEventLoopGroup group = new NioEventLoopGroup();
    }
}

I tried to analyze the issue, and as I understand it, it is an chicken&egg problem: at init time Netty is trying to log into gelf which uses not yet initialized Netty \o/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions