tkowalcz / tjahzi

Java clients, log4j2 and logback appenders for Grafana Loki
MIT License
106 stars 18 forks source link

java.lang.UnsupportedOperationException: Reflective setAccessible(true) disabled #116

Closed rapar8 closed 1 year ago

rapar8 commented 1 year ago
java.lang.UnsupportedOperationException: Reflective setAccessible(true) disabled
    at pl.tkowalcz.tjahzi.io.netty.util.internal.ReflectionUtil.trySetAccessible(ReflectionUtil.java:31)
    at pl.tkowalcz.tjahzi.io.netty.util.internal.PlatformDependent0$4.run(PlatformDependent0.java:238)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
    at pl.tkowalcz.tjahzi.io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:232)
    at pl.tkowalcz.tjahzi.io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:289)
    at pl.tkowalcz.tjahzi.io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:92)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoop.newTaskQueue0(NioEventLoop.java:279)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoop.newTaskQueue(NioEventLoop.java:150)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoop.<init>(NioEventLoop.java:138)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:146)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:37)
    at pl.tkowalcz.tjahzi.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:84)
    at pl.tkowalcz.tjahzi.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:58)
    at pl.tkowalcz.tjahzi.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:47)
    at pl.tkowalcz.tjahzi.io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:59)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:86)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:81)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:68)
    at pl.tkowalcz.tjahzi.http.HttpConnection.<init>(HttpConnection.java:26)
    at pl.tkowalcz.tjahzi.http.NettyHttpClient.<init>(NettyHttpClient.java:32)
    at pl.tkowalcz.tjahzi.http.HttpClientFactory.getHttpClient(HttpClientFactory.java:13)
    at pl.tkowalcz.tjahzi.logback.LokiAppenderFactory.createAppender(LokiAppenderFactory.java:56)
    at pl.tkowalcz.tjahzi.logback.LokiAppender.start(LokiAppender.java:89)
    at ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:90)

followed by

2023-08-17 13:29:23,621 [main] DEBUG p.t.t.i.n.u.i.PlatformDependent0 - java.nio.Bits.unaligned: available, true
2023-08-17 13:29:23,624 [main] DEBUG p.t.t.i.n.u.i.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable
java.lang.IllegalAccessException: class pl.tkowalcz.tjahzi.io.netty.util.internal.PlatformDependent0$6 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @41a2befb
    at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:394)
    at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at pl.tkowalcz.tjahzi.io.netty.util.internal.PlatformDependent0$6.run(PlatformDependent0.java:352)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
    at pl.tkowalcz.tjahzi.io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:343)
    at pl.tkowalcz.tjahzi.io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:289)
    at pl.tkowalcz.tjahzi.io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:92)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoop.newTaskQueue0(NioEventLoop.java:279)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoop.newTaskQueue(NioEventLoop.java:150)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoop.<init>(NioEventLoop.java:138)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:146)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:37)
    at pl.tkowalcz.tjahzi.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:84)
    at pl.tkowalcz.tjahzi.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:58)
    at pl.tkowalcz.tjahzi.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:47)
    at pl.tkowalcz.tjahzi.io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:59)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:86)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:81)
    at pl.tkowalcz.tjahzi.io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:68)
    at pl.tkowalcz.tjahzi.http.HttpConnection.<init>(HttpConnection.java:26)
    at pl.tkowalcz.tjahzi.http.NettyHttpClient.<init>(NettyHttpClient.java:32)
    at pl.tkowalcz.tjahzi.http.HttpClientFactory.getHttpClient(HttpClientFactory.java:13)
    at pl.tkowalcz.tjahzi.logback.LokiAppenderFactory.createAppender(LokiAppenderFactory.java:56)
    at pl.tkowalcz.tjahzi.logback.LokiAppender.start(LokiAppender.java:89)
    at ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:90)
<configuration>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d [%thread] %level %logger{15} - %msg%n</pattern>
        </encoder>
    </appender>

    <appender name="Loki" class="pl.tkowalcz.tjahzi.logback.LokiAppender">
        <host>logs.kontext.abc.com</host>
        <port>443</port>

        <header>
            <name>Authorization</name>
            <value>
                Basic T..==
            </value>
        </header>

        <efficientLayout>
            <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
        </efficientLayout>

        <label>
            <name>server</name>
            <value>SVCLYR.LOKI</value>
        </label>
    </appender>

    <logger name="com.solacesystems.jcsmp.*" level="error" additivity="false">
        <appender-ref ref="STDOUT"/>
    </logger>

    <root level="info">
        <appender-ref ref="STDOUT"/>
        <appender-ref ref="Loki"/>
    </root>
</configuration>
tkowalcz commented 1 year ago

Does this exception prevent the app from starting? Are you using Netty in a different version than what is shipped with Tjahzi? What is the JDK version you run on?

rapar8 commented 1 year ago

@tkowalcz JAVA 18 pl.tkowalcz.tjahzi:logback-appender0.9.31

after updating to 0.9.32 errors seems gone, may be we can close this issue