Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error message:SRCFG00027 in quarkus-2.2.3.Final and quarkus-2.2.2.Final, while test case worked correctly in quarkus-2.2.1.Final #20243

Closed
falcantaracano opened this issue Sep 17, 2021 · 4 comments · Fixed by #20103
Assignees
Labels
area/config env/windows Impacts Windows machines kind/bug Something isn't working
Milestone

Comments

@falcantaracano
Copy link

falcantaracano commented Sep 17, 2021

Describe the bug

I have develop a configuration PoC. This PoC works correctly with Quarkus 2.1.1.Final, but it fails with Quarkus 2.2.2.Final and Quarkus 2.2.3.Final.

I'm getting the following error:
sept. 17, 2021 5:15:19 P. M. org.examples.quarkus.configuration.MdPConfigurationMapping
ERROR: Getting MdP Configuration Mapping, message:SRCFG00027: Could not find a mapping for org.examples.quarkus.configuration.MdPConfiguration

java.util.NoSuchElementException: SRCFG00027: Could not find a mapping for org.examples.quarkus.configuration.MdPConfiguration.

The problem is related to the moment in which Flyway extension needs the credential to the H2 database. These credentials are provided through a own credential provider

Expected behavior

The Flayway can read the credential configuration, load database model and execute correctly the test cases.

D:\desa\eclipse-dev\quarkus-config2>mvnw test
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< org.examples.quarkus:quarkus-config2 >----------------
[INFO] Building quarkus-config2 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- quarkus-maven-plugin:2.2.1.Final:generate-code (default) @ quarkus-config2 ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ quarkus-config2 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ quarkus-config2 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 9 source files to D:\desa\eclipse-dev\quarkus-config2\target\classes
[INFO] /D:/desa/eclipse-dev/quarkus-config2/src/main/java/org/examples/quarkus/configuration/SystemLoggingConfigurationBean.java: D:\desa\eclipse-dev\quarkus-config2\src\main\java\org\examples\quarkus\configuration\SystemLoggingConfigurationBean.java uses unchecked or unsafe operations.
[INFO] /D:/desa/eclipse-dev/quarkus-config2/src/main/java/org/examples/quarkus/configuration/SystemLoggingConfigurationBean.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- quarkus-maven-plugin:2.2.1.Final:generate-code-tests (default) @ quarkus-config2 ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ quarkus-config2 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ quarkus-config2 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to D:\desa\eclipse-dev\quarkus-config2\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ quarkus-config2 ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.examples.quarkus.configuration.ConfigurationTest
17:10:19:177 INFO (build-53) [i.q.f.FlywayProcessor] Adding application migrations in path '/D:/desa/eclipse-dev/quarkus-config2/target/test-classes/db/migration-test/' using protocol 'file'
[INFO] H2 database started in TCP server mode; server status: TCP server running at tcp://192.168.1.58:9092 (only local connections)
17:10:21:577 INFO (main) [o.f.c.i.l.VersionPrinter] Flyway Community Edition 7.14.0 by Redgate
17:10:21:577 INFO (main) [o.f.c.i.d.b.BaseDatabaseType] Database: jdbc:h2:tcp://localhost/mem:sqlcobol (H2 1.4)
17:10:21:690 INFO (main) [o.f.c.i.c.DbClean] Successfully dropped pre-schema database level objects (execution time 00:00.001s)
17:10:21:697 INFO (main) [o.f.c.i.c.DbClean] Successfully cleaned schema "PUBLIC" (execution time 00:00.005s)
17:10:21:698 INFO (main) [o.f.c.i.c.DbClean] Successfully dropped post-schema database level objects (execution time 00:00.000s)
17:10:21:709 INFO (main) [o.f.c.i.l.VersionPrinter] Flyway Community Edition 7.14.0 by Redgate
17:10:21:747 INFO (main) [o.f.c.i.s.JdbcTableSchemaHistory] Creating Schema History table "PUBLIC"."flyway_schema_history" ...
17:10:21:830 INFO (main) [o.f.c.i.c.DbMigrate] Current version of schema "PUBLIC": << Empty Schema >>
17:10:21:840 INFO (main) [o.f.c.i.c.DbMigrate] Migrating schema "PUBLIC" to version "1.0.0 - H2 EXAMPLES INITIAL DDL"
17:10:21:897 INFO (main) [o.f.c.i.c.DbMigrate] Successfully applied 1 migration to schema "PUBLIC", now at version v1.0.0 (execution time 00:00.104s)
17:10:21:926 INFO (main) [i.quarkus] Quarkus 2.2.1.Final on JVM started in 5.809s.
17:10:21:939 INFO (main) [i.quarkus] Profile test activated.
17:10:21:939 INFO (main) [i.quarkus] Installed features: [agroal, cdi, config-yaml, flyway, jdbc-h2, jdbc-oracle, narayana-jta, smallrye-context-propagation]
17:10:22:060 INFO (main) [o.e.q.c.ConfigurationTest] test2: MdPConfiguration [
security: SecurityConfiguration [ sharedKey: SharedKey [ filename: shared.key, typeFile: resource], credentials: [Credential [ type: h2, username: tools, password: admin123]]]
, log: SystemLoggingConfiguration [ category: {io.prolead: CategoryInfo [ out: WARN, err: DEBUG], org.antlr: CategoryInfo [ out: INFO, err: ERROR]}]
]
17:10:22:095 INFO (main) [o.e.q.c.ConfigurationTest] test1: MdPConfiguration [
security: SecurityConfiguration [ sharedKey: SharedKey [ filename: shared.key, typeFile: resource], credentials: [Credential [ type: h2, username: tools, password: admin123]]]
, log: SystemLoggingConfiguration [ category: {io.prolead: CategoryInfo [ out: WARN, err: DEBUG], org.antlr: CategoryInfo [ out: INFO, err: ERROR]}]
]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.732 s - in org.examples.quarkus.configuration.ConfigurationTest
17:10:22:142 INFO (main) [i.quarkus] Quarkus stopped in 0.011s
[INFO] H2 database was shut down; server status: Not started
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32.920 s
[INFO] Finished at: 2021-09-17T17:10:22+02:00
[INFO] ------------------------------------------------------------------------

Actual behavior

The test cases don't work. NoSuchElementException is raised for accesing to configuration mapping.

D:\desa\eclipse-dev\quarkus-config2>mvnw test
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< org.examples.quarkus:quarkus-config2 >----------------
[INFO] Building quarkus-config2 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- quarkus-maven-plugin:2.2.3.Final:generate-code (default) @ quarkus-config2 ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ quarkus-config2 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ quarkus-config2 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 9 source files to D:\desa\eclipse-dev\quarkus-config2\target\classes
[INFO] /D:/desa/eclipse-dev/quarkus-config2/src/main/java/org/examples/quarkus/configuration/SystemLoggingConfigurationBean.java: D:\desa\eclipse-dev\quarkus-config2\src\main\java\org\examples\quarkus\configuration\SystemLoggingConfigurationBean.java uses unchecked or unsafe operations.
[INFO] /D:/desa/eclipse-dev/quarkus-config2/src/main/java/org/examples/quarkus/configuration/SystemLoggingConfigurationBean.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- quarkus-maven-plugin:2.2.3.Final:generate-code-tests (default) @ quarkus-config2 ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ quarkus-config2 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ quarkus-config2 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to D:\desa\eclipse-dev\quarkus-config2\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ quarkus-config2 ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.examples.quarkus.configuration.ConfigurationTest
17:15:16:737 INFO (build-4) [i.q.f.FlywayProcessor] Adding application migrations in path '/D:/desa/eclipse-dev/quarkus-config2/target/test-classes/db/migration-test/' using protocol 'file'
[INFO] H2 database started in TCP server mode; server status: TCP server running at tcp://192.168.1.58:9092 (only local connections)
sept. 17, 2021 5:15:19 P. M. org.examples.quarkus.configuration.MdPConfigurationMapping
ERROR: Getting MdP Configuration Mapping, message:SRCFG00027: Could not find a mapping for org.examples.quarkus.configuration.MdPConfiguration

java.util.NoSuchElementException: SRCFG00027: Could not find a mapping for org.examples.quarkus.configuration.MdPConfiguration
at io.smallrye.config.ConfigMappings.getConfigMapping(ConfigMappings.java:73)
at io.smallrye.config.ConfigMappings.getConfigMapping(ConfigMappings.java:63)
at io.smallrye.config.SmallRyeConfig.getConfigMapping(SmallRyeConfig.java:393)
at org.examples.quarkus.configuration.MdPConfigurationMapping.getMdPConfiguration(MdPConfigurationMapping.java:15)
at org.examples.quarkus.secretkeys.MyBbddCredentialsProvider.(MyBbddCredentialsProvider.java:37)
at org.examples.quarkus.secretkeys.MyBbddCredentialsProvider_ClientProxy.(MyBbddCredentialsProvider_ClientProxy.zig:28)
at org.examples.quarkus.secretkeys.MyBbddCredentialsProvider_Bean.proxy(MyBbddCredentialsProvider_Bean.zig:40)
at org.examples.quarkus.secretkeys.MyBbddCredentialsProvider_Bean.get(MyBbddCredentialsProvider_Bean.zig:228)
at org.examples.quarkus.secretkeys.MyBbddCredentialsProvider_Bean.get(MyBbddCredentialsProvider_Bean.zig:244)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:434)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:447)
at io.quarkus.arc.impl.ArcContainerImpl.instance(ArcContainerImpl.java:312)
at io.quarkus.credentials.runtime.CredentialsProviderFinder.find(CredentialsProviderFinder.java:12)
at io.quarkus.agroal.runtime.DataSources.applyNewConfiguration(DataSources.java:253)
at io.quarkus.agroal.runtime.DataSources.doCreateDataSource(DataSources.java:168)
at io.quarkus.agroal.runtime.DataSources$1.apply(DataSources.java:111)
at io.quarkus.agroal.runtime.DataSources$1.apply(DataSources.java:108)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
at io.quarkus.agroal.runtime.DataSources.getDataSource(DataSources.java:108)
at io.quarkus.agroal.runtime.DataSources.fromName(DataSources.java:104)
at io.quarkus.agroal.runtime.AgroalRecorder.agroalDataSourceSupplier(AgroalRecorder.java:30)
at io.quarkus.deployment.steps.AgroalProcessor$generateDataSourceBeans-109901991.deploy_0(AgroalProcessor$generateDataSourceBeans-109901991.zig:81)
at io.quarkus.deployment.steps.AgroalProcessor$generateDataSourceBeans-109901991.deploy(AgroalProcessor$generateDataSourceBeans-109901991.zig:40)
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:339)
at io.quarkus.runtime.Application.start(Application.java:101)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.runner.bootstrap.StartupActionImpl.run(StartupActionImpl.java:181)
at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:387)
at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:705)
at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:752)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$8(ClassBasedTestDescriptor.java:368)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:368)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:192)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:78)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:136)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:188)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:154)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:128)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:428)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:562)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:548)

[INFO] H2 database was shut down; server status: Not started
[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 1, Time elapsed: 17.752 s <<< FAILURE! - in org.examples.quarkus.configuration.ConfigurationTest
[ERROR] org.examples.quarkus.configuration.ConfigurationTest.test2PathsConfiguration Time elapsed: 0.03 s <<< ERROR!
java.lang.RuntimeException: java.lang.RuntimeException: Failed to start quarkus
Caused by: java.lang.RuntimeException: Failed to start quarkus
Caused by: java.util.NoSuchElementException: SRCFG00027: Could not find a mapping for org.examples.quarkus.configuration.MdPConfiguration

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] ConfigurationTest.test2PathsConfiguration » Runtime java.lang.RuntimeException...
[INFO]
[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 40.967 s
[INFO] Finished at: 2021-09-17T17:15:20+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project quarkus-config2: There are test failures.
[ERROR]
[ERROR] Please refer to D:\desa\eclipse-dev\quarkus-config2\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

How to Reproduce?

quarkus-config2.zip

Steps to reproduce the error:
1.- Execute mvnw test

Output of uname -a or ver

Microsoft Windows [Versión 10.0.19043.1165]

Output of java -version

openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment Temurin-11.0.12+7 (build 11.0.12+7) OpenJDK 64-Bit Server VM Temurin-11.0.12+7 (build 11.0.12+7, mixed mode)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.2.3.Final

Build tool (ie. output of mvnw --version or gradlew --version)

_Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: D:\desa\apache-maven-3.8.1\bin..
Java version: 11.0.12, vendor: Eclipse Foundation, runtime: D:\AdoptOpenJDK\jdk-11.0.12.7-hotspot
Default locale: es_ES, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Additional information

No response

@falcantaracano falcantaracano added the kind/bug Something isn't working label Sep 17, 2021
@quarkus-bot quarkus-bot bot added env/windows Impacts Windows machines triage/needs-triage labels Sep 17, 2021
@famod
Copy link
Member

famod commented Sep 17, 2021

I suppose this is the result of #19937 but I'll let @radcortez answer that.

@geoand
Copy link
Contributor

geoand commented Sep 20, 2021

Also, this looks like a duplicate of #20257, no?

@famod
Copy link
Member

famod commented Sep 20, 2021

Or the other way around. 😉

@radcortez
Copy link
Member

I suppose this is the result of #19937 but I'll let @radcortez answer that.

Correct.

We added a new PR to fix the issue is a better way: #20103

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants