avioconsulting / mule-vault-properties-provider

Mule 4 Properties Provider for properties from HashiCorp Vault
BSD 2-Clause "Simplified" License
6 stars 7 forks source link

Null pointer exception with maven tests #32

Open manikmagar opened 1 year ago

manikmagar commented 1 year ago

Module version: 1.0.0

Environment -

❯ java -version
openjdk version "1.8.0_382"
OpenJDK Runtime Environment (Zulu 8.72.0.17-CA-macos-aarch64) (build 1.8.0_382-b05)
OpenJDK 64-Bit Server VM (Zulu 8.72.0.17-CA-macos-aarch64) (build 25.382-b05, mixed mode)
❯ mvn --version
Apache Maven 3.8.7 (b89d5959fcde851dcb1c8946a785a163f14e1e29)
Maven home: /Users/mmagar/.sdkman/candidates/maven/current
Java version: 1.8.0_382, vendor: Azul Systems, Inc., runtime: /Users/mmagar/.sdkman/candidates/java/8.0.382-zulu/zulu-8.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "13.3.1", arch: "aarch64", family: "mac"

Dependencies:

        <app.runtime>4.4.0</app.runtime>
        <mule.maven.plugin.version>3.5.4</mule.maven.plugin.version>
        <munit.version>2.3.9</munit.version>

When running munit tests from command line mvn test, app deployment fails with following error -

WARN  2023-09-08 21:54:24,200 [Embedded] org.mule.runtime.extension.internal.loader.enricher.ConfigRefDeclarationEnricher: Component 'console' in extension 'APIKit' already has a 'config-ref' parameter defined. Skipping ConfigRefDeclarationEnricher for it.
WARN  2023-09-08 21:54:24,200 [Embedded] org.mule.runtime.extension.internal.loader.enricher.ConfigRefDeclarationEnricher: Component 'router' in extension 'APIKit' already has a 'config-ref' parameter defined. Skipping ConfigRefDeclarationEnricher for it.
WARN  2023-09-08 21:54:25,129 [Embedded] com.avioconsulting.mule.vault.provider.api.VaultConfigurationPropertiesProviderFactory: No Vault Properties Provider configurations found
INFO  2023-09-08 21:54:25,139 [Embedded] org.mule.runtime.module.deployment.impl.internal.artifact.AbstractDeployableArtifact: Application 'tg-shot-api' never started, nothing to dispose of
ERROR 2023-09-08 21:54:25,135 [Embedded] org.mule.runtime.module.deployment.impl.internal.application.DefaultMuleApplication: null
java.lang.NullPointerException: null
    at com.avioconsulting.mule.vault.provider.api.VaultConfigurationPropertiesProviderFactory.createProvider(VaultConfigurationPropertiesProviderFactory.java:46) ~[?:?]
    at org.mule.runtime.config.api.dsl.model.properties.ConfigurationPropertiesProviderFactory.createProvider(ConfigurationPropertiesProviderFactory.java:62) ~[mule-module-spring-config-4.4.0.jar:4.4.0]
    at org.mule.runtime.config.internal.model.properties.PropertiesResolverUtils.lambda$getConfigurationPropertiesProvidersFromComponents$5(PropertiesResolverUtils.java:283) ~[mule-module-spring-config-4.4.0.jar:4.4.0]

    at org.mule.runtime.config.internal.model.properties.PropertiesResolverUtils.getConfigurationPropertiesProvidersFromComponents(PropertiesResolverUtils.java:297) ~[mule-module-spring-config-4.4.0.jar:4.4.0]

I have tried enabling local mode but it still fails.

Loandt1 commented 3 weeks ago

I changed to 3.8.6 and it helped. Maybe you have to add runtimeVersion to 4.4.0-20220824 in of Munit block.