Home > other >  Micronaut JAR throws BeanInstantiationException, but not when running with IntelliJ
Micronaut JAR throws BeanInstantiationException, but not when running with IntelliJ

Time:08-26

I recently packaged my Micronaut application using Maven: ./mvnw package

This generates a JAR file, which I run using: java -jar /path/to/jar/app_name-0.1.jar

For some reason, the application throws a io.micronaut.context.exceptions.BeanInstantiationException when running the JAR. That does not happen when I run the application in IntelliJ. Am I doing something wrong in regards to building/running? I am using JDK 18.

Thanks!

Stack trace:

08:25:03.092 [default-nioEventLoopGroup-1-2] WARN  i.n.c.AbstractChannelHandlerContext - An exception 'io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type  [io.micronaut.security.authentication.Authenticator]

Message: Could not initialize class com.app.security.CustomAuthenticationProvider
Path Taken: new SecurityFilter(Collection securityRules,Collection authenticationFetchers,SecurityConfiguration securityConfiguration) --> new SecurityFilter(Collection securityRules,[Collection authenticationFetchers],SecurityConfiguration securityConfiguration) --> new BasicAuthAuthenticationFetcher([Authenticator authenticator]) --> new Authenticator([Collection authenticationProviders],SecurityConfiguration securityConfiguration)' [enable DEBUG level for full stacktrace] was thrown by a user handler's exceptionCaught() method while handling the following exception:
io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type  [io.micronaut.security.authentication.Authenticator]

Path Taken: new SecurityFilter(Collection securityRules,Collection authenticationFetchers,SecurityConfiguration securityConfiguration) --> new SecurityFilter(Collection securityRules,[Collection authenticationFetchers],SecurityConfiguration securityConfiguration) --> new BasicAuthAuthenticationFetcher([Authenticator authenticator]) --> new Authenticator([Collection authenticationProviders],SecurityConfiguration securityConfiguration)
    at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2367)
    at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2305)
    at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2251)
    at io.micronaut.context.DefaultBeanContext.createRegistration(DefaultBeanContext.java:3016)
    at io.micronaut.context.SingletonScope.getOrCreate(SingletonScope.java:80)
    at io.micronaut.context.DefaultBeanContext.findOrCreateSingletonBeanRegistration(DefaultBeanContext.java:2918)
    at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2879)
    at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2853)
    at io.micronaut.context.DefaultBeanContext.addCandidateToList(DefaultBeanContext.java:3511)
    at io.micronaut.context.DefaultBeanContext.resolveBeanRegistrations(DefaultBeanContext.java:3457)
    at io.micronaut.context.DefaultBeanContext.getBeanRegistrations(DefaultBeanContext.java:3427)
    at io.micronaut.context.DefaultBeanContext.getBeansOfType(DefaultBeanContext.java:1381)
    at io.micronaut.context.AbstractBeanResolutionContext.getBeansOfType(AbstractBeanResolutionContext.java:72)
    at io.micronaut.context.AbstractInitializableBeanDefinition.resolveBeansOfType(AbstractInitializableBeanDefinition.java:2161)
    at io.micronaut.context.AbstractInitializableBeanDefinition.getBeansOfTypeForConstructorArgument(AbstractInitializableBeanDefinition.java:1437)
    at io.micronaut.security.authentication.$Authenticator$Definition.build(Unknown Source)
    at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2354)
    at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2305)
    at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2251)
    at io.micronaut.context.DefaultBeanContext.createRegistration(DefaultBeanContext.java:3016)
    at io.micronaut.context.SingletonScope.getOrCreate(SingletonScope.java:80)
    at io.micronaut.context.DefaultBeanContext.findOrCreateSingletonBeanRegistration(DefaultBeanContext.java:2918)
    at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2879)
    at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2800)
    at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1617)
    at io.micronaut.context.AbstractBeanResolutionContext.getBean(AbstractBeanResolutionContext.java:66)
    at io.micronaut.context.AbstractInitializableBeanDefinition.resolveBean(AbstractInitializableBeanDefinition.java:2065)
    at io.micronaut.context.AbstractInitializableBeanDefinition.getBeanForConstructorArgument(AbstractInitializableBeanDefinition.java:1297)
    at io.micronaut.security.authentication.$BasicAuthAuthenticationFetcher$Definition.build(Unknown Source)
    at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2354)
    at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2305)
    at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2251)
    at io.micronaut.context.DefaultBeanContext.createRegistration(DefaultBeanContext.java:3016)
    at io.micronaut.context.SingletonScope.getOrCreate(SingletonScope.java:80)
    at io.micronaut.context.DefaultBeanContext.findOrCreateSingletonBeanRegistration(DefaultBeanContext.java:2918)
    at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2879)
    at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2853)
    at io.micronaut.context.DefaultBeanContext.addCandidateToList(DefaultBeanContext.java:3511)
    at io.micronaut.context.DefaultBeanContext.resolveBeanRegistrations(DefaultBeanContext.java:3457)
    at io.micronaut.context.DefaultBeanContext.getBeanRegistrations(DefaultBeanContext.java:3427)
    at io.micronaut.context.DefaultBeanContext.getBeansOfType(DefaultBeanContext.java:1381)
    at io.micronaut.context.AbstractBeanResolutionContext.getBeansOfType(AbstractBeanResolutionContext.java:72)
    at io.micronaut.context.AbstractInitializableBeanDefinition.resolveBeansOfType(AbstractInitializableBeanDefinition.java:2161)
    at io.micronaut.context.AbstractInitializableBeanDefinition.getBeansOfTypeForConstructorArgument(AbstractInitializableBeanDefinition.java:1437)
    at io.micronaut.security.filters.$SecurityFilter$Definition.build(Unknown Source)
    at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2354)
    at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2305)
    at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2251)
    at io.micronaut.context.DefaultBeanContext.createRegistration(DefaultBeanContext.java:3016)
    at io.micronaut.context.SingletonScope.getOrCreate(SingletonScope.java:80)
    at io.micronaut.context.DefaultBeanContext.findOrCreateSingletonBeanRegistration(DefaultBeanContext.java:2918)
    at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2879)
    at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2853)
    at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1583)
    at io.micronaut.web.router.BeanDefinitionFilterRoute.lambda$new$0(BeanDefinitionFilterRoute.java:43)
    at io.micronaut.web.router.DefaultFilterRoute.getFilter(DefaultFilterRoute.java:96)
    at io.micronaut.web.router.DefaultRouter.lambda$new$0(DefaultRouter.java:64)
    at io.micronaut.core.util.SupplierUtil$1.initialize(SupplierUtil.java:48)
    at io.micronaut.core.util.SupplierUtil$1.get(SupplierUtil.java:43)
    at io.micronaut.web.router.DefaultRouter.findFilters(DefaultRouter.java:438)
    at io.micronaut.http.server.RouteExecutor.filterPublisher(RouteExecutor.java:371)
    at io.micronaut.http.server.RouteExecutor.buildResultEmitter(RouteExecutor.java:634)
    at io.micronaut.http.server.RouteExecutor.executeRoute(RouteExecutor.java:354)
    at io.micronaut.http.server.netty.RoutingInBoundHandler.handleRouteMatch(RoutingInBoundHandler.java:594)
    at io.micronaut.http.server.netty.RoutingInBoundHandler.channelRead0(RoutingInBoundHandler.java:457)
    at io.micronaut.http.server.netty.RoutingInBoundHandler.channelRead0(RoutingInBoundHandler.java:147)
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:102)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.micronaut.http.netty.reactive.HandlerPublisher.channelRead(HandlerPublisher.java:325)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.micronaut.http.netty.stream.HttpStreamsHandler.channelRead(HttpStreamsHandler.java:279)
    at io.micronaut.http.netty.stream.HttpStreamsServerHandler.channelRead(HttpStreamsServerHandler.java:134)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
    at io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtensionHandler.channelRead(WebSocketServerExtensionHandler.java:99)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
    at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
    at io.netty.handler.codec.http.HttpServerKeepAliveHandler.channelRead(HttpServerKeepAliveHandler.java:64)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.flow.FlowControlHandler.dequeue(FlowControlHandler.java:200)
    at io.netty.handler.flow.FlowControlHandler.channelRead(FlowControlHandler.java:162)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:314)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:435)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279)
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ExceptionInInitializerError: null
    at com.app.app.$CustomAuthenticationProvider$Definition.build(Unknown Source)
    at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2354)
    ... 136 common frames omitted
Caused by: java.lang.UnsupportedOperationException: No class provided, and an appropriate one cannot be found.
    at org.apache.logging.log4j.LogManager.callerClass(LogManager.java:573)
    at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:598)
    at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:585)
    at com.app.security.CustomAuthenticationProvider.<clinit>(CustomAuthenticationProvider.java:75)
    ... 138 common frames omitted

CustomAuthenticationProvider:

//imports

@Singleton
public class CustomAuthenticationProvider implements AuthenticationProvider {
    private final DatabaseConfiguration databaseConfiguration;

    private static final User USER;

    private static final Logger LOGGER;

    static {
        USER = User.USER;

        LOGGER = LogManager.getLogger();
    } //static

    public CustomAuthenticationProvider(DatabaseConfiguration databaseConfiguration) {
        this.databaseConfiguration = databaseConfiguration;
    } //CustomAuthenticationProvider

    private Integer findUser(String email, String password) {
        Objects.requireNonNull(email, "the specified email is null");

        Objects.requireNonNull(password, "the specified password is null");

        String databaseUrl = this.databaseConfiguration.url();

        Record record;

        try (Connection connection = DriverManager.getConnection(databaseUrl)) {
            DSLContext context = DSL.using(connection, SQLDialect.POSTGRES);

            record = context.select(USER.ID, USER.PASSWORD_HASH)
                            .from(USER)
                            .where(USER.EMAIL.eq(email))
                            .fetchOne();
        } catch (SQLException | DataAccessException e) {
            LOGGER.atError()
                  .withThrowable(e)
                  .log();

            return null;
        } //end try catch

        if (record == null) {
            return null;
        } //end if

        String passwordHash = record.get(USER.PASSWORD_HASH);

        boolean matches = Password.check(password, passwordHash)
                                  .withBcrypt();

        if (!matches) {
            return null;
        } //end if

        return record.get(USER.ID);
    } //findUser

    @Override
    public Publisher<AuthenticationResponse> authenticate(HttpRequest<?> httpRequest,
        AuthenticationRequest<?, ?> authenticationRequest) {
        return Flux.create(emitter -> {
            Object identity = authenticationRequest.getIdentity();

            Object secret = authenticationRequest.getSecret();

            if (!(identity instanceof String email) || !(secret instanceof String password)) {
                AuthenticationException authenticationException = AuthenticationResponse.exception();

                emitter.error(authenticationException);

                return;
            } //end if

            email = email.toLowerCase();

            Integer userId = this.findUser(email, password);

            if (userId == null) {
                AuthenticationException authenticationException = AuthenticationResponse.exception();

                emitter.error(authenticationException);

                return;
            } //end if

            String userIdString = String.valueOf(userId);

            AuthenticationResponse successResponse = AuthenticationResponse.success(userIdString);

            emitter.next(successResponse);

            emitter.complete();
        }, FluxSink.OverflowStrategy.ERROR);
    } //authenticate
}

pom.xml:

<?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>com.app</groupId>
    <artifactId>app_name</artifactId>
    <version>0.1</version>
    <packaging>${packaging}</packaging>

    <parent>
        <groupId>io.micronaut</groupId>
        <artifactId>micronaut-parent</artifactId>
        <version>3.6.1</version>
    </parent>

    <properties>
        <packaging>jar</packaging>
        <jdk.version>18</jdk.version>
        <release.version>18</release.version>
        <micronaut.version>3.6.1</micronaut.version>
        <micronaut.runtime>netty</micronaut.runtime>
        <exec.mainClass>com.app.Application</exec.mainClass>
    </properties>

    <repositories>
        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>io.micronaut</groupId>
            <artifactId>micronaut-inject</artifactId>
            <scope>compile</scope>
            <version>3.6.1</version>
        </dependency>
        <dependency>
            <groupId>io.micronaut</groupId>
            <artifactId>micronaut-validation</artifactId>
            <scope>compile</scope>
            <version>3.6.1</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
            <version>5.9.0</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
            <version>5.9.0</version>
        </dependency>
        <dependency>
            <groupId>io.micronaut.test</groupId>
            <artifactId>micronaut-test-junit5</artifactId>
            <scope>test</scope>
            <version>3.5.0</version>
        </dependency>
        <dependency>
            <groupId>io.micronaut</groupId>
            <artifactId>micronaut-http-client</artifactId>
            <scope>compile</scope>
            <version>3.6.1</version>
        </dependency>
        <dependency>
            <groupId>io.micronaut</groupId>
            <artifactId>micronaut-http-server-netty</artifactId>
            <scope>compile</scope>
            <version>3.6.1</version>
        </dependency>
        <dependency>
            <groupId>io.micronaut</groupId>
            <artifactId>micronaut-jackson-databind</artifactId>
            <scope>compile</scope>
            <version>3.6.1</version>
        </dependency>
        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <scope>compile</scope>
            <version>2.1.1</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>runtime</scope>
            <version>1.2.11</version>
        </dependency>
        <dependency>
            <groupId>io.micronaut.security</groupId>
            <artifactId>micronaut-security-jwt</artifactId>
            <version>3.7.0</version>
        </dependency>
        <dependency>
            <groupId>io.micronaut</groupId>
            <artifactId>micronaut-management</artifactId>
            <scope>compile</scope>
            <version>3.6.1</version>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-core</artifactId>
            <version>3.4.22</version>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.4.2</version>
        </dependency>
        <dependency>
            <groupId>org.jooq</groupId>
            <artifactId>jooq</artifactId>
            <version>3.17.3</version>
        </dependency>
        <dependency>
            <groupId>com.password4j</groupId>
            <artifactId>password4j</artifactId>
            <version>1.6.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.18.0</version>
        </dependency>
        <dependency>
            <groupId>io.micronaut.test</groupId>
            <artifactId>micronaut-test-rest-assured</artifactId>
            <scope>test</scope>
            <version>3.5.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>io.micronaut.build</groupId>
                <artifactId>micronaut-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <!-- Uncomment to enable incremental compilation -->
                    <!-- <useIncrementalCompilation>false</useIncrementalCompilation> -->

                    <annotationProcessorPaths combine.children="append">
                        <path>
                            <groupId>io.micronaut</groupId>
                            <artifactId>micronaut-http-validation</artifactId>
                            <version>${micronaut.version}</version>
                        </path>
                    </annotationProcessorPaths>
                    <compilerArgs>
                        <arg>-Amicronaut.processing.group=com.app</arg>
                        <arg>-Amicronaut.processing.module=app_name</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

$CustomAuthenticationProvider$Definition:

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.app.security;

import com.app.utils.DatabaseConfiguration;
import io.micronaut.context.AbstractInitializableBeanDefinition;
import io.micronaut.context.BeanContext;
import io.micronaut.context.BeanResolutionContext;
import io.micronaut.context.Qualifier;
import io.micronaut.core.annotation.AnnotationMetadata;
import io.micronaut.core.annotation.Generated;
import io.micronaut.core.type.Argument;
import io.micronaut.inject.BeanDefinition;
import io.micronaut.inject.BeanFactory;
import io.micronaut.inject.ExecutableMethodsDefinition;
import java.util.Map;
import java.util.Optional;

// $FF: synthetic class
@Generated
class $CustomAuthenticationProvider$Definition extends AbstractInitializableBeanDefinition<CustomAuthenticationProvider> implements BeanFactory<CustomAuthenticationProvider> {
    private static final AbstractInitializableBeanDefinition.MethodOrFieldReference $CONSTRUCTOR = new AbstractInitializableBeanDefinition.MethodReference(CustomAuthenticationProvider.class, "<init>", new Argument[]{Argument.of(DatabaseConfiguration.class, "databaseConfiguration")}, (AnnotationMetadata)null, false);

    public CustomAuthenticationProvider build(BeanResolutionContext var1, BeanContext var2, BeanDefinition var3) {
        CustomAuthenticationProvider var4 = new CustomAuthenticationProvider((DatabaseConfiguration)super.getBeanForConstructorArgument(var1, var2, 0, (Qualifier)null));
        var4 = (CustomAuthenticationProvider)this.injectBean(var1, var2, var4);
        return var4;
    }

    protected Object injectBean(BeanResolutionContext var1, BeanContext var2, Object var3) {
        CustomAuthenticationProvider var4 = (CustomAuthenticationProvider)var3;
        return super.injectBean(var1, var2, var3);
    }

    public $CustomAuthenticationProvider$Definition() {
        this(CustomAuthenticationProvider.class, $CONSTRUCTOR);
    }

    protected $CustomAuthenticationProvider$Definition(Class var1, AbstractInitializableBeanDefinition.MethodOrFieldReference var2) {
        super(var1, var2, $CustomAuthenticationProvider$Definition$Reference.$ANNOTATION_METADATA, (AbstractInitializableBeanDefinition.MethodReference[])null, (AbstractInitializableBeanDefinition.FieldReference[])null, (AbstractInitializableBeanDefinition.AnnotationReference[])null, (ExecutableMethodsDefinition)null, (Map)null, Optional.of("javax.inject.Singleton"), false, false, false, true, false, false, false, false);
    }
}

CodePudding user response:

It's related to Log4J, a quick search found a similar problem:

LogManager.getLogger() is unable to determine class name on Java 11

  • Related