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

io.micronaut.context.exceptions.NoSuchBeanException while running on Github Actions #785

Open
jurna opened this issue Dec 6, 2024 · 5 comments

Comments

@jurna
Copy link

jurna commented Dec 6, 2024

Expected Behavior

Tests with test micronaut-test-resources should run on Github Actions

Actual Behaviour

While running github actions with test resources and mongodb repositories, github actions hangs. Logs contains some errors:

test-resources-service] 09:58:46.617 [main] INFO  i.m.c.DefaultApplicationContext$RuntimeConfiguredEnvironment - Established active environments: [test]
[test-resources-service] 09:58:46.633 [main] INFO  i.m.t.e.TestResourcesResolverLoader - Loaded 2 test resources resolvers: io.micronaut.testresources.mongodb.MongoDBTestResourceProvider, io.micronaut.testresources.testcontainers.GenericTestContainerProvider
[test-resources-service] 09:58:46.679 [pool-1-thread-1] INFO  o.testcontainers.DockerClientFactory - Testcontainers version: 2.7.0
[test-resources-service] 09:58:47.059 [pool-1-thread-1] INFO  o.t.d.DockerClientProviderStrategy - Found Docker environment with local Unix socket (unix:///var/run/docker.sock)
[test-resources-service] 09:58:47.084 [pool-1-thread-1] INFO  o.testcontainers.DockerClientFactory - Docker host IP address is localhost
[test-resources-service] 09:58:47.102 [pool-1-thread-1] INFO  o.testcontainers.DockerClientFactory - Connected to docker: 
  Server Version: 26.1.3
  API Version: 1.45
  Operating System: Ubuntu 22.04.5 LTS
  Total Memory: 7929 MB
[test-resources-service] 09:58:47.112 [pool-1-thread-1] INFO  o.testcontainers.images.PullPolicy - Image pull policy will be performed by: DefaultPullPolicy()
[test-resources-service] 09:58:47.114 [pool-1-thread-1] INFO  o.t.utility.ImageNameSubstitutor - Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
[test-resources-service] 09:58:47.140 [pool-1-thread-1] INFO  tc.testcontainers/ryuk:0.9.0 - Pulling docker image: testcontainers/ryuk:0.9.0. Please be patient; this may take some time but only needs to be done once.
[test-resources-service] 09:58:48.168 [docker-java-stream--1467452668] INFO  tc.testcontainers/ryuk:0.9.0 - Starting to pull image
[test-resources-service] 09:58:48.183 [docker-java-stream--1467452668] INFO  tc.testcontainers/ryuk:0.9.0 - Pulling image layers:  0 pending,  0 downloaded,  0 extracted, (0 bytes/0 bytes)
[test-resources-service] 09:58:48.690 [docker-java-stream--1467452668] INFO  tc.testcontainers/ryuk:0.9.0 - Pulling image layers:  2 pending,  1 downloaded,  0 extracted, (8 KB/? MB)
[test-resources-service] 09:58:48.717 [docker-java-stream--1467452668] INFO  tc.testcontainers/ryuk:0.9.0 - Pulling image layers:  1 pending,  2 downloaded,  0 extracted, (118 KB/? MB)
[test-resources-service] 09:58:48.732 [docker-java-stream--1467452668] INFO  tc.testcontainers/ryuk:0.9.0 - Pulling image layers:  0 pending,  3 downloaded,  0 extracted, (118 KB/11 MB)
[test-resources-service] 09:58:48.854 [docker-java-stream--1467452668] INFO  tc.testcontainers/ryuk:0.9.0 - Pulling image layers:  0 pending,  3 downloaded,  1 extracted, (3 MB/11 MB)
[test-resources-service] 09:58:50.895 [docker-java-stream--1467452668] INFO  tc.testcontainers/ryuk:0.9.0 - Pulling image layers:  0 pending,  3 downloaded,  2 extracted, (4 MB/11 MB)
[test-resources-service] 09:58:50.950 [docker-java-stream--1467452668] INFO  tc.testcontainers/ryuk:0.9.0 - Pulling image layers:  0 pending,  3 downloaded,  3 extracted, (11 MB/11 MB)
[test-resources-service] 09:58:50.963 [docker-java-stream--1467452668] INFO  tc.testcontainers/ryuk:0.9.0 - Pull complete. 3 layers, pulled in 2s (downloaded 11 MB at 5 MB/s)
[test-resources-service] 09:58:50.963 [pool-1-thread-1] INFO  tc.testcontainers/ryuk:0.9.0 - Image testcontainers/ryuk:0.9.0 pull took PT3.82284[41](https://github.com/Metasiteorg/demo-micronaut/actions/runs/12196727959/job/34024911875#step:5:42)54S
[test-resources-service] 09:58:50.984 [pool-1-thread-1] INFO  tc.testcontainers/ryuk:0.9.0 - Creating container for image: testcontainers/ryuk:0.9.0
[test-resources-service] 09:58:51.045 [pool-1-thread-1] INFO  tc.testcontainers/ryuk:0.9.0 - Container testcontainers/ryuk:0.9.0 is starting: 3240019e908960b6a6ce6c85b52d0ed71c2d600f91aa6382a6ee987d4b31ed25
[test-resources-service] 09:58:51.410 [pool-1-thread-1] INFO  tc.testcontainers/ryuk:0.9.0 - Container testcontainers/ryuk:0.9.0 started in PT0.[42](https://github.com/Metasiteorg/demo-micronaut/actions/runs/12196727959/job/34024911875#step:5:43)5696434S
Error: Exception in thread "main" io.micronaut.runtime.exceptions.ApplicationStartupException: Error starting Micronaut server: No bean of type [io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.context.event.StartupEvent>] exists. 
	at io.micronaut.runtime.Micronaut.handleStartupException(Micronaut.java:353)
	at io.micronaut.runtime.Micronaut.start(Micronaut.java:174)
	at io.micronaut.runtime.Micronaut.run(Micronaut.java:334)
	at io.micronaut.runtime.Micronaut.run(Micronaut.java:320)
	at io.micronaut.testresources.server.TestResourcesService.main(TestResourcesService.java:[43](https://github.com/Metasiteorg/demo-micronaut/actions/runs/12196727959/job/34024911875#step:5:44))
Caused by: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.context.event.StartupEvent>] exists. 
	at io.micronaut.context.DefaultBeanContext.newNoSuchBeanException(DefaultBeanContext.java:2798)
	at io.micronaut.context.DefaultApplicationContext.newNoSuchBeanException(DefaultApplicationContext.java:329)
	at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2761)
	at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:17[45](https://github.com/Metasiteorg/demo-micronaut/actions/runs/12196727959/job/34024911875#step:5:46))
	at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:842)
	at io.micronaut.context.BeanLocator.getBean(BeanLocator.java:97)
	at io.micronaut.context.DefaultBeanContext.publishEvent(DefaultBeanContext.java:1831)
	at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:360)
	at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:216)
	at io.micronaut.runtime.Micronaut.start(Micronaut.java:75)
	... 3 more
[test-resources-service] 09:58:[51](https://github.com/Metasiteorg/demo-micronaut/actions/runs/12196727959/job/34024911875#step:5:52).415 [pool-1-thread-1] INFO  o.t.utility.RyukResourceReaper - Ryuk started - will monitor and terminate Testcontainers containers on JVM exit
[test-resources-service] 09:58:51.415 [pool-1-thread-1] INFO  o.testcontainers.DockerClientFactory - Checking the system...
[test-resources-service] 09:58:51.415 [pool-1-thread-1] INFO  o.testcontainers.DockerClientFactory - ✔︎ Docker server version should be at least 1.6.0
> Task :internalStartTestResourcesService

Steps To Reproduce

Create github actions job

name: Java CI with Gradle

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build:

    runs-on: ubuntu-latest
    permissions:
      contents: read

    steps:
    - uses: actions/checkout@v4
    - name: Set up JDK
      uses: actions/setup-java@v4
      with:
        java-version: '21'
        distribution: 'temurin'

    - name: Setup Gradle
      uses: gradle/actions/setup-gradle@v4

    - name: Build
      run: ./gradlew build

Environment Information

No response

Example Application

No response

Version

4.7.1

@jurna
Copy link
Author

jurna commented Dec 6, 2024

Micronaut version 4.6.1 works fine. Version 4.7.1 does not

@melix
Copy link
Collaborator

melix commented Dec 6, 2024

Can you share a reproducer? The https://github.com/Metasiteorg/demo-micronaut repo doesn't seem to be available.

@jurna
Copy link
Author

jurna commented Dec 9, 2024

Copied to public repo https://github.com/jurna/demo-micronaut

@jurna
Copy link
Author

jurna commented Dec 9, 2024

Strangely on my personal account github actions builds successfully. But on private organisation repo I have error mentioned above. Mabye some racing condition depending on how fast is the machine on which you are building?

@nareshpaturi
Copy link

nareshpaturi commented Dec 13, 2024

im also facing the same issue in github actions .Mine repo is in a private organization .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants