Closed scprek closed 1 year ago
Something is strange: I tried your project and here it does not behave the same:
$ MICRONAUT_ENVIRONMENTS=remote ./gradlew run --scan
> Task :kaptKotlin
Note: Creating bean classes for 2 type elements
> Task :run
__ __ _ _
| \/ (_) ___ _ __ ___ _ __ __ _ _ _| |_
| |\/| | |/ __| '__/ _ \| '_ \ / _` | | | | __|
| | | | | (__| | | (_) | | | | (_| | |_| | |_
|_| |_|_|\___|_| \___/|_| |_|\__,_|\__,_|\__|
Micronaut (v3.8.6)
09:13:10.116 [main] INFO i.m.context.env.DefaultEnvironment - Established active environments: [remote]
09:13:10.735 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
09:13:11.755 [main] ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Exception during pool initialization.
org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:331)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:247)
at org.postgresql.Driver.makeConnection(Driver.java:434)
at org.postgresql.Driver.connect(Driver.java:291)
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364)
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
at io.micronaut.configuration.jdbc.hikari.HikariUrlDataSource.<init>(HikariUrlDataSource.java:35)
at io.micronaut.configuration.jdbc.hikari.DatasourceFactory.dataSource(DatasourceFactory.java:66)
at io.micronaut.configuration.jdbc.hikari.$DatasourceFactory$DataSource0$Definition.build(Unknown Source)
at io.micronaut.context.BeanDefinitionDelegate.build(BeanDefinitionDelegate.java:161)
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.loadContextScopeBean(DefaultBeanContext.java:2737)
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1915)
at io.micronaut.context.DefaultApplicationContext.initializeContext(DefaultApplicationContext.java:249)
at io.micronaut.context.DefaultBeanContext.readAllBeanDefinitionClasses(DefaultBeanContext.java:3326)
at io.micronaut.context.DefaultBeanContext.finalizeConfiguration(DefaultBeanContext.java:3684)
at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:341)
at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:194)
at io.micronaut.runtime.Micronaut.start(Micronaut.java:75)
at io.micronaut.runtime.Micronaut.run(Micronaut.java:323)
at io.micronaut.runtime.Micronaut.run(Micronaut.java:298)
at com.example.ApplicationKt.main(Application.kt:5)
Caused by: java.net.UnknownHostException: <test-path>
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:567)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
at java.base/java.net.Socket.connect(Socket.java:633)
at org.postgresql.core.PGStream.createSocket(PGStream.java:241)
at org.postgresql.core.PGStream.<init>(PGStream.java:98)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:109)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:235)
... 32 common frames omitted
09:13:11.757 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: Bean definition [javax.sql.DataSource] could not be loaded: Error instantiating bean of type [javax.sql.DataSource]
Message: Failed to initialize pool: The connection attempt failed.
Path Taken: DataSource.dataSource(DatasourceConfiguration datasourceConfiguration)
io.micronaut.context.exceptions.BeanInstantiationException: Bean definition [javax.sql.DataSource] could not be loaded: Error instantiating bean of type [javax.sql.DataSource]
Message: Failed to initialize pool: The connection attempt failed.
Path Taken: DataSource.dataSource(DatasourceConfiguration datasourceConfiguration)
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1921)
at io.micronaut.context.DefaultApplicationContext.initializeContext(DefaultApplicationContext.java:249)
at io.micronaut.context.DefaultBeanContext.readAllBeanDefinitionClasses(DefaultBeanContext.java:3326)
at io.micronaut.context.DefaultBeanContext.finalizeConfiguration(DefaultBeanContext.java:3684)
at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:341)
at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:194)
at io.micronaut.runtime.Micronaut.start(Micronaut.java:75)
at io.micronaut.runtime.Micronaut.run(Micronaut.java:323)
at io.micronaut.runtime.Micronaut.run(Micronaut.java:298)
at com.example.ApplicationKt.main(Application.kt:5)
Caused by: io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type [javax.sql.DataSource]
Message: Failed to initialize pool: The connection attempt failed.
Path Taken: DataSource.dataSource(DatasourceConfiguration datasourceConfiguration)
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.loadContextScopeBean(DefaultBeanContext.java:2737)
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1915)
... 9 common frames omitted
Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: The connection attempt failed.
at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:596)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:582)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
at io.micronaut.configuration.jdbc.hikari.HikariUrlDataSource.<init>(HikariUrlDataSource.java:35)
at io.micronaut.configuration.jdbc.hikari.DatasourceFactory.dataSource(DatasourceFactory.java:66)
at io.micronaut.configuration.jdbc.hikari.$DatasourceFactory$DataSource0$Definition.build(Unknown Source)
at io.micronaut.context.BeanDefinitionDelegate.build(BeanDefinitionDelegate.java:161)
at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2354)
... 16 common frames omitted
Caused by: org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:331)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:247)
at org.postgresql.Driver.makeConnection(Driver.java:434)
at org.postgresql.Driver.connect(Driver.java:291)
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364)
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
... 23 common frames omitted
Caused by: java.net.UnknownHostException: <test-path>
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:567)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
at java.base/java.net.Socket.connect(Socket.java:633)
at org.postgresql.core.PGStream.createSocket(PGStream.java:241)
at org.postgresql.core.PGStream.<init>(PGStream.java:98)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:109)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:235)
... 32 common frames omitted
https://scans.gradle.com/s/z7n7vpwrvrhts
I am confused :/
Yeah so am !!! I also restarted Docker Desktop on Mac just to try and same result
Did you also see redis
startup when just doing ./gradlew run
, it still doesn't for me.
That's why I asked in chat about the proper cleanup to switch environments. If I check that docker ps
is cleaned up, run ./gradlew clean stopTestResourcesService
just in case, then MICRONAUT_ENVIRONMENTS=remote ./gradlew run
I get the following still.
https://scans.gradle.com/s/yyp2depeyd6he
Operating system | macOS 12.6 (x86_64)
Java runtime | Eclipse Temurin OpenJDK Runtime Environment 11.0.14+9
Java VM | Eclipse Temurin OpenJDK 64-Bit Server VM 11.0.14+9 (mixed mode)
$ ./gradlew clean stopTestResourcesService
> Task :stopTestResourcesService
Stopping test resources service
BUILD SUCCESSFUL in 1s
2 actionable tasks: 2 executed
$ MICRONAUT_ENVIRONMENTS=remote ./gradlew run --scan
06:58:18.945 [main] INFO i.m.context.env.DefaultEnvironment - Established active environments: [remote]
06:58:18.971 [ForkJoinPool.commonPool-worker-19] INFO i.m.t.e.TestResourcesResolverLoader - Loaded 4 test resources resolvers: io.micronaut.testresources.postgres.PostgreSQLTestResourceProvider, io.micronaut.testresources.kafka.KafkaTestResourceProvider, io.micronaut.testresources.redis.RedisTestResourceProvider, io.micronaut.testresources.testcontainers.GenericTestContainerProvider
06:58:19.419 [main] INFO i.m.testresources.server.Application - A Micronaut Test Resources server is listening on port 62542, started in 1125ms
> Task :internalStartTestResourcesService
Test resources server started in standalone mode. You can stop it by running the stopTestResourcesService task.
> Task :kaptKotlin
Note: Creating bean classes for 2 type elements
> Task :run
__ __ _ _
| \/ (_) ___ _ __ ___ _ __ __ _ _ _| |_
| |\/| | |/ __| '__/ _ \| '_ \ / _` | | | | __|
| | | | | (__| | | (_) | | | | (_| | |_| | |_
|_| |_|_|\___|_| \___/|_| |_|\__,_|\__,_|\__|
Micronaut (v3.8.6)
06:58:22.811 [main] INFO i.m.context.env.DefaultEnvironment - Established active environments: [remote]
06:58:23.896 [default-nioEventLoopGroup-1-2] INFO i.m.t.e.TestResourcesResolverLoader - Loaded 4 test resources resolvers: io.micronaut.testresources.postgres.PostgreSQLTestResourceProvider, io.micronaut.testresources.kafka.KafkaTestResourceProvider, io.micronaut.testresources.redis.RedisTestResourceProvider, io.micronaut.testresources.testcontainers.GenericTestContainerProvider
06:58:24.403 [default-nioEventLoopGroup-1-7] INFO o.t.utility.ImageNameSubstitutor - Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
06:58:24.406 [default-nioEventLoopGroup-1-7] INFO i.m.t.testcontainers.TestContainers - Starting test container postgres
06:58:24.424 [default-nioEventLoopGroup-1-7] INFO o.t.d.DockerClientProviderStrategy - Loaded org.testcontainers.dockerclient.UnixSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first
06:58:25.024 [default-nioEventLoopGroup-1-7] INFO o.t.d.DockerClientProviderStrategy - Found Docker environment with local Unix socket (unix:///var/run/docker.sock)
06:58:25.025 [default-nioEventLoopGroup-1-7] INFO o.testcontainers.DockerClientFactory - Docker host IP address is localhost
06:58:25.062 [default-nioEventLoopGroup-1-7] INFO o.testcontainers.DockerClientFactory - Connected to docker:
Server Version: 20.10.21
API Version: 1.41
Operating System: Docker Desktop
Total Memory: 9951 MB
06:58:25.069 [default-nioEventLoopGroup-1-7] INFO o.testcontainers.DockerClientFactory - Checking the system...
06:58:25.070 [default-nioEventLoopGroup-1-7] INFO o.testcontainers.DockerClientFactory - βοΈ Docker server version should be at least 1.6.0
06:58:25.187 [default-nioEventLoopGroup-1-7] INFO π³ [postgres:latest] - Creating container for image: postgres:latest
06:58:25.421 [default-nioEventLoopGroup-1-7] INFO π³ [testcontainers/ryuk:0.3.4] - Creating container for image: testcontainers/ryuk:0.3.4
06:58:25.535 [default-nioEventLoopGroup-1-7] INFO π³ [testcontainers/ryuk:0.3.4] - Container testcontainers/ryuk:0.3.4 is starting: cf3bb72c9df6e7e18caae62f7eea0bb05348b4e316d6ef5b89481539800980c1
06:58:25.841 [default-nioEventLoopGroup-1-7] INFO π³ [testcontainers/ryuk:0.3.4] - Container testcontainers/ryuk:0.3.4 started in PT0.420722S
06:58:25.874 [default-nioEventLoopGroup-1-7] INFO π³ [postgres:latest] - Container postgres:latest is starting: 9f1538d4f838eda734a0c6ff48910df8a222d8092f273ea7ac356650088e27ba
06:58:26.849 [default-nioEventLoopGroup-1-7] INFO π³ [postgres:latest] - Container postgres:latest started in PT1.777908S
> Task :run
06:58:26.868 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
06:58:27.924 [main] ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Exception during pool initialization.
org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:331)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:247)
at org.postgresql.Driver.makeConnection(Driver.java:434)
at org.postgresql.Driver.connect(Driver.java:291)
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364)
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
at io.micronaut.configuration.jdbc.hikari.HikariUrlDataSource.<init>(HikariUrlDataSource.java:35)
at io.micronaut.configuration.jdbc.hikari.DatasourceFactory.dataSource(DatasourceFactory.java:66)
at io.micronaut.configuration.jdbc.hikari.$DatasourceFactory$DataSource0$Definition.build(Unknown Source)
at io.micronaut.context.BeanDefinitionDelegate.build(BeanDefinitionDelegate.java:161)
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.loadContextScopeBean(DefaultBeanContext.java:2737)
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1915)
at io.micronaut.context.DefaultApplicationContext.initializeContext(DefaultApplicationContext.java:249)
at io.micronaut.context.DefaultBeanContext.readAllBeanDefinitionClasses(DefaultBeanContext.java:3326)
at io.micronaut.context.DefaultBeanContext.finalizeConfiguration(DefaultBeanContext.java:3684)
at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:341)
at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:194)
at io.micronaut.runtime.Micronaut.start(Micronaut.java:75)
at io.micronaut.runtime.Micronaut.run(Micronaut.java:323)
at io.micronaut.runtime.Micronaut.run(Micronaut.java:298)
at com.example.ApplicationKt.main(Application.kt:5)
Caused by: java.net.UnknownHostException: <test-path>
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:229)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:609)
at org.postgresql.core.PGStream.createSocket(PGStream.java:241)
at org.postgresql.core.PGStream.<init>(PGStream.java:98)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:109)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:235)
... 32 common frames omitted
06:58:27.928 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: Bean definition [javax.sql.DataSource] could not be loaded: Error instantiating bean of type [javax.sql.DataSource]
Message: Failed to initialize pool: The connection attempt failed.
Path Taken: DataSource.dataSource(DatasourceConfiguration datasourceConfiguration)
io.micronaut.context.exceptions.BeanInstantiationException: Bean definition [javax.sql.DataSource] could not be loaded: Error instantiating bean of type [javax.sql.DataSource]
Message: Failed to initialize pool: The connection attempt failed.
Path Taken: DataSource.dataSource(DatasourceConfiguration datasourceConfiguration)
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1921)
at io.micronaut.context.DefaultApplicationContext.initializeContext(DefaultApplicationContext.java:249)
at io.micronaut.context.DefaultBeanContext.readAllBeanDefinitionClasses(DefaultBeanContext.java:3326)
at io.micronaut.context.DefaultBeanContext.finalizeConfiguration(DefaultBeanContext.java:3684)
at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:341)
at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:194)
at io.micronaut.runtime.Micronaut.start(Micronaut.java:75)
at io.micronaut.runtime.Micronaut.run(Micronaut.java:323)
at io.micronaut.runtime.Micronaut.run(Micronaut.java:298)
at com.example.ApplicationKt.main(Application.kt:5)
Caused by: io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type [javax.sql.DataSource]
Message: Failed to initialize pool: The connection attempt failed.
Path Taken: DataSource.dataSource(DatasourceConfiguration datasourceConfiguration)
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.loadContextScopeBean(DefaultBeanContext.java:2737)
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1915)
... 9 common frames omitted
Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: The connection attempt failed.
at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:596)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:582)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
at io.micronaut.configuration.jdbc.hikari.HikariUrlDataSource.<init>(HikariUrlDataSource.java:35)
at io.micronaut.configuration.jdbc.hikari.DatasourceFactory.dataSource(DatasourceFactory.java:66)
at io.micronaut.configuration.jdbc.hikari.$DatasourceFactory$DataSource0$Definition.build(Unknown Source)
at io.micronaut.context.BeanDefinitionDelegate.build(BeanDefinitionDelegate.java:161)
at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2354)
... 16 common frames omitted
Caused by: org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:331)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:247)
at org.postgresql.Driver.makeConnection(Driver.java:434)
at org.postgresql.Driver.connect(Driver.java:291)
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364)
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
... 23 common frames omitted
Caused by: java.net.UnknownHostException: <test-path>
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:229)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:609)
at org.postgresql.core.PGStream.createSocket(PGStream.java:241)
at org.postgresql.core.PGStream.<init>(PGStream.java:98)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:109)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:235)
... 32 common frames omitted
> Task :run FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':run'.
> Process 'command '/Users/stevecprek/.sdkman/candidates/java/11.0.14-tem/bin/java'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
8 actionable tasks: 8 executed
Publishing a build scan to scans.gradle.com requires accepting the Gradle Terms of Service defined at https://gradle.com/terms-of-service. Do you accept these terms? [yes, no] yes
Gradle Terms of Service accepted.
Publishing build scan...
https://gradle.com/s/yyp2depeyd6he
So here's what I see (logs stripped for clarity, look at the build scans for full output)
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ ./gradlew test --scan
> Task :internalStartTestResourcesService
Test resources server started in standalone mode. You can stop it by running the stopTestResourcesService task.
...
> Task :kaptTestKotlin
...
14:05:24.024 [default-nioEventLoopGroup-1-7] INFO i.m.t.testcontainers.TestContainers - Starting test container postgres
14:05:25.195 [default-nioEventLoopGroup-1-7] INFO π³ [testcontainers/ryuk:0.3.4] - Creating container for image: testcontainers/ryuk:0.3.4
14:05:25.705 [default-nioEventLoopGroup-1-7] INFO π³ [postgres:latest] - Creating container for image: postgres:latest
14:05:26.941 [default-nioEventLoopGroup-1-15] INFO π³ [confluentinc/cp-kafka:7.0.4] - Creating container for image: confluentinc/cp-kafka:7.0.4
BUILD SUCCESSFUL in 17s
https://scans.gradle.com/s/x63t4dzvhisca
So the test
build passes, let's see that all docker containers are still alive (because you are using sharedServer
(why? This should only be used if you want to share the containers between distinct projects):
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3dd1d81fff97 confluentinc/cp-kafka:7.0.4 "sh -c '#!/bin/bash\nβ¦" 2 minutes ago Up 2 minutes 9092/tcp, 0.0.0.0:33784->2181/tcp, 0.0.0.0:33783->9093/tcp crazy_maxwell
729bdb77ccf2 postgres:latest "docker-entrypoint.sβ¦" 2 minutes ago Up 2 minutes 0.0.0.0:33782->5432/tcp stoic_haibt
14b667aea756 testcontainers/ryuk:0.3.4 "/app" 2 minutes ago Up 2 minutes 0.0.0.0:33781->8080/tcp testcontainers-ryuk-4b64c960-14c6-4c7d-a3ce-09a667a184b8
So let's stop the test resources service:
$ ./gradlew stopTRS
> Task :stopTestResourcesService
Stopping test resources service
BUILD SUCCESSFUL in 632ms
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
As expected, all containers are shutdown. Now let's run with the production environment:
$ MICRONAUT_ENVIRONMENTS=remote ./gradlew run --scan
14:12:12.358 [ForkJoinPool.commonPool-worker-8] INFO i.m.t.e.TestResourcesResolverLoader - Loaded 4 test resources resolvers: io.micronaut.testresources.postgres.PostgreSQLTestResourceProvider, io.micronaut.testresources.kafka.KafkaTestResourceProvider, io.micronaut.testresources.redis.RedisTestResourceProvider, io.micronaut.testresources.testcontainers.GenericTestContainerProvider
...
14:12:13.751 [default-nioEventLoopGroup-1-7] INFO i.m.t.testcontainers.TestContainers - Starting test container postgres
https://scans.gradle.com/s/m374zcgfjwdt4
So I see the same behavior as you do. That's good news, because initially I wasn't seeing a container starting in logs, which makes sense because I didn't have shutdown the test resources service (I didn't notice you used sharedServer=true).
I also checked with sharedServer=false
and I'm seeing the same behavior (as expected), but now I can investigate.
Sounds good. So I didn't notice that micronaut launch
created a gradle with sharedServer
set to true. My other service def does not have it.
I ran with sharedServer=false
and also hit just like you.
Right, it's probably Micronaut Launch generating sharedServer=true
because you are using kafka, and that it makes sense to share the test kafka server between projects. Anyway, unrelated to this issue.
Ok I have found the problem, and it's a nasty one. You are missing one property datasources.test-db.driverClassName
, and it's not your fault, it seems that launch.micronaut.io
generates datasources.test-db.driver-class-name
. Switch to driverClassName
and it will behave as expected.
Closing, now tracked at https://github.com/micronaut-projects/micronaut-starter/issues/1650
Ok, I thought maybe that db-type: postgres
would help too, i specified that in the other services just in case dialect or the other methods were not working.
After fixing postgres config field, @melix I still don't see redis starting with "default" run ./gradlew run
I've noticed a similar issue with my service but instead of redis, kafka doesn't start. I was thinking it might be the same problem.
Context above in the original submission "Default" sections, but as you can see
07:44:53.554 [default-nioEventLoopGroup-1-2] INFO i.m.t.e.TestResourcesResolverLoader - Loaded 4 test resources resolvers: io.micronaut.testresources.postgres.PostgreSQLTestResourceProvider, io.micronaut.testresources.kafka.KafkaTestResourceProvider, io.micronaut.testresources.redis.RedisTestResourceProvider, io.micronaut.testresources.testcontainers.GenericTestContainerProvider
Note that the test resources service will only start when the property is actually queried, so it can be because of laziness.
Ahhhhh amazing thanks. I forgot I had eager init in my other service! I tossed it in this demo project and see redis starting for local, however I see a similar issue with remote
environment.
I believe the issue is micronaut test resources is only looking for redis.uri
not redis.uris
(cluster_mode). When I switch from uris
to uri
the redis container does not startup. But it also seems like micronaut is now expecting to see uri?
Gradle Scan: https://gradle.com/s/uebxjaihye4nk
$ MICRONAUT_ENVIRONMENTS=remote ./gradlew run --scan
07:57:16.301 [main] INFO i.m.context.env.DefaultEnvironment - Established active environments: [remote]
07:57:16.328 [ForkJoinPool.commonPool-worker-9] INFO i.m.t.e.TestResourcesResolverLoader - Loaded 4 test resources resolvers: io.micronaut.testresources.postgres.PostgreSQLTestResourceProvider, io.micronaut.testresources.kafka.KafkaTestResourceProvider, io.micronaut.testresources.redis.RedisTestResourceProvider, io.micronaut.testresources.testcontainers.GenericTestContainerProvider
07:57:16.806 [main] INFO i.m.testresources.server.Application - A Micronaut Test Resources server is listening on port 50798, started in 1254ms
> Task :kaptKotlin
Note: Creating bean classes for 2 type elements
> Task :run
__ __ _ _
| \/ (_) ___ _ __ ___ _ __ __ _ _ _| |_
| |\/| | |/ __| '__/ _ \| '_ \ / _` | | | | __|
| | | | | (__| | | (_) | | | | (_| | |_| | |_
|_| |_|_|\___|_| \___/|_| |_|\__,_|\__,_|\__|
Micronaut (v3.8.6)
07:57:21.302 [main] INFO i.m.context.env.DefaultEnvironment - Established active environments: [remote]
07:57:22.432 [default-nioEventLoopGroup-1-2] INFO i.m.t.e.TestResourcesResolverLoader - Loaded 4 test resources resolvers: io.micronaut.testresources.postgres.PostgreSQLTestResourceProvider, io.micronaut.testresources.kafka.KafkaTestResourceProvider, io.micronaut.testresources.redis.RedisTestResourceProvider, io.micronaut.testresources.testcontainers.GenericTestContainerProvider
07:57:23.137 [default-nioEventLoopGroup-1-7] INFO o.t.utility.ImageNameSubstitutor - Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
07:57:23.143 [default-nioEventLoopGroup-1-7] INFO i.m.t.testcontainers.TestContainers - Starting test container redis
07:57:23.163 [default-nioEventLoopGroup-1-7] INFO o.t.d.DockerClientProviderStrategy - Loaded org.testcontainers.dockerclient.UnixSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first
07:57:23.655 [default-nioEventLoopGroup-1-7] INFO o.t.d.DockerClientProviderStrategy - Found Docker environment with local Unix socket (unix:///var/run/docker.sock)
07:57:23.657 [default-nioEventLoopGroup-1-7] INFO o.testcontainers.DockerClientFactory - Docker host IP address is localhost
07:57:23.698 [default-nioEventLoopGroup-1-7] INFO o.testcontainers.DockerClientFactory - Connected to docker:
Server Version: 20.10.22
API Version: 1.41
Operating System: Docker Desktop
Total Memory: 9951 MB
07:57:23.703 [default-nioEventLoopGroup-1-7] INFO o.testcontainers.DockerClientFactory - Checking the system...
07:57:23.703 [default-nioEventLoopGroup-1-7] INFO o.testcontainers.DockerClientFactory - βοΈ Docker server version should be at least 1.6.0
07:57:23.804 [default-nioEventLoopGroup-1-7] INFO π³ [redis:latest] - Creating container for image: redis:latest
07:57:24.071 [default-nioEventLoopGroup-1-7] INFO π³ [testcontainers/ryuk:0.3.4] - Creating container for image: testcontainers/ryuk:0.3.4
07:57:24.201 [default-nioEventLoopGroup-1-7] INFO π³ [testcontainers/ryuk:0.3.4] - Container testcontainers/ryuk:0.3.4 is starting: ae97d12e907446f459e04b7ac81d11bc1a5abe355388f012a99fa58cb853f66f
07:57:24.515 [default-nioEventLoopGroup-1-7] INFO π³ [testcontainers/ryuk:0.3.4] - Container testcontainers/ryuk:0.3.4 started in PT0.445604S
07:57:24.547 [default-nioEventLoopGroup-1-7] INFO π³ [redis:latest] - Container redis:latest is starting: 3736c4886b61f53e3ac4210efc8873dddb5bb6416676b2abcb2cd14ec302af31
07:57:24.806 [default-nioEventLoopGroup-1-7] INFO π³ [redis:latest] - Container redis:latest started in PT1.102013S
> Task :run
07:57:24.820 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: Bean definition [com.example.$RedisExample$Definition$Intercepted] could not be loaded: Error instantiating bean of type [io.lettuce.core.cluster.RedisClusterClient]
Message: URI must not be null
Path Taken: RedisClusterClient.redisClient(AbstractRedisConfiguration config,ClientResources defaultClientResources) --> RedisClusterClient.redisClient([AbstractRedisConfiguration config],ClientResources defaultClientResources)
io.micronaut.context.exceptions.BeanInstantiationException: Bean definition [com.example.$RedisExample$Definition$Intercepted] could not be loaded: Error instantiating bean of type [io.lettuce.core.cluster.RedisClusterClient]
Message: URI must not be null
Path Taken: RedisClusterClient.redisClient(AbstractRedisConfiguration config,ClientResources defaultClientResources) --> RedisClusterClient.redisClient([AbstractRedisConfiguration config],ClientResources defaultClientResources)
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1921)
at io.micronaut.context.DefaultApplicationContext.initializeContext(DefaultApplicationContext.java:249)
at io.micronaut.context.DefaultBeanContext.readAllBeanDefinitionClasses(DefaultBeanContext.java:3326)
at io.micronaut.context.DefaultBeanContext.finalizeConfiguration(DefaultBeanContext.java:3684)
at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:341)
at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:194)
at io.micronaut.runtime.Micronaut.start(Micronaut.java:75)
at com.example.Application.main(Application.kt:12)
Caused by: io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type [io.lettuce.core.cluster.RedisClusterClient]
Message: URI must not be null
Path Taken: RedisClusterClient.redisClient(AbstractRedisConfiguration config,ClientResources defaultClientResources) --> RedisClusterClient.redisClient([AbstractRedisConfiguration config],ClientResources defaultClientResources)
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: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.configuration.lettuce.$DefaultRedisClusterClientFactory$RedisClient0$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.findBean(DefaultBeanContext.java:1680)
at io.micronaut.context.DefaultBeanContext.findBean(DefaultBeanContext.java:1655)
at io.micronaut.context.DefaultBeanContext.findBean(DefaultBeanContext.java:878)
at io.micronaut.context.BeanLocator.findBean(BeanLocator.java:291)
at io.micronaut.configuration.lettuce.RedisConnectionUtil.findRedisClusterClient(RedisConnectionUtil.java:125)
at io.micronaut.configuration.lettuce.RedisConnectionUtil.openBytesRedisConnection(RedisConnectionUtil.java:109)
at io.micronaut.configuration.lettuce.cache.RedisCache.<init>(RedisCache.java:81)
at io.micronaut.configuration.lettuce.cache.$RedisCache$Definition.build(Unknown Source)
at io.micronaut.context.BeanDefinitionDelegate.build(BeanDefinitionDelegate.java:161)
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.cache.$DefaultCacheManager$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.cache.interceptor.$CacheInterceptor$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.AbstractBeanResolutionContext.getBeanRegistrations(AbstractBeanResolutionContext.java:96)
at io.micronaut.context.AbstractInitializableBeanDefinition.resolveBeanRegistrations(AbstractInitializableBeanDefinition.java:2190)
at io.micronaut.context.AbstractInitializableBeanDefinition.getBeanRegistrationsForConstructorArgument(AbstractInitializableBeanDefinition.java:1461)
at com.example.$RedisExample$Definition$Intercepted$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.loadContextScopeBean(DefaultBeanContext.java:2746)
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1915)
... 7 common frames omitted
Caused by: java.lang.IllegalArgumentException: URI must not be null
at io.lettuce.core.internal.LettuceAssert.notNull(LettuceAssert.java:71)
at io.lettuce.core.RedisURI.buildRedisUriFromUri(RedisURI.java:751)
at io.lettuce.core.RedisURI.create(RedisURI.java:308)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at io.micronaut.configuration.lettuce.AbstractRedisConfiguration.setUris(AbstractRedisConfiguration.java:80)
at io.micronaut.configuration.lettuce.$DefaultRedisConfiguration$Definition.injectBean(Unknown Source)
at io.micronaut.configuration.lettuce.$DefaultRedisConfiguration$Definition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2354)
... 88 common frames omitted
> Task :run FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':run'.
> Process 'command '/Users/stevecprek/.sdkman/candidates/java/11.0.14-tem/bin/java'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 20s
8 actionable tasks: 7 executed, 1 up-to-date
Publishing a build scan to scans.gradle.com requires accepting the Gradle Terms of Service defined at https://gradle.com/terms-of-service. Do you accept these terms? [yes, no] yes
Gradle Terms of Service accepted.
Publishing build scan...
https://gradle.com/s/uebxjaihye4nk
Maybe itβs because both uri and uris is specified due to test resources
Re-opening because investigation showed that the postgres issue may be fixable in test resources (see #183 ).
We may need a separate issue for the redis case, because I didn't investigate that one yet.
@scprek for redis I can confirm this is because of laziness. If I use this for your main app, then you can see it starting:
import io.micronaut.runtime.Micronaut.build
fun main(args: Array<String>) {
build()
.eagerInitSingletons(true)
.args(*args)
.start()
}
Yep understood. I got that working with the same but test resources doesn't look for redis.uris is my issue.
Guessing it should check both uri and uris
Feel free to add a PR to add support for redis.uris
too (and maybe a PR ;))
Opened the redis ticket so will close the bug
For context, I am trying to create 2 micronaut environments and have the ability to specify
remote
for connecting to dev resources if needed instead of containers. However these issues still occur if everything is just in application.yml for example I put the postgres URLs in theapplication.yml
file and it still was starting the container.Expected Behavior
I have postgres, kafka, redis and when I have the following, I expect all containers to start up
Default
./gradlew run
application.yml
Postgres, kafka, and redis containers startup
Remote environment
MICRONAUT_ENVIRONMENTS=remote ./gradlew run
note: I also moved the postgres url/un/pwd into the
application.yml
file directly and postgres still startedapplication-remote.yml
No containers startup
Actual Behavior
Just to point out, in my other service redis and kafka start up containers with and without url/boostraps specified. So I'm wondering if there is some weird case that applies to any containers/combo of containers
Default
No redis
Remote environment
However there is a postgres error trying to use the placeholder text in
application-remote.yml
which indicates it is not actually using the container that was started.Steps To Reproduce
Run commands above in the attached repo.
Environment Information
Example Application
https://github.com/scprek/test-resources-always-starting
Version
3.8.6