0

I reviewed the problem and then opened a pull request to spring cloud stream. It was merged upstream and back ported to 4.0.x.

So this problem is solved.

Pull Request Link : https://github.com/spring-cloud/spring-cloud-stream/pull/2791


I have a spring application running using Spring Cloud Function(Spring Native). I am consuming some data using cloud function. Also, I run my project with a native docker image(Spring Native). However, when I add spring-boot-starter-actuator and spring-boot-starter-web dependencies to my project, my project starts throwing an error in runtime. I want to be able to trace the metrics of my binders. Can you help me what should I do?

Additional Info : If I run it without a native image, there is no problem. This problem occurs when I build native docker image and run it.

Spring Boot Starter Parent Version : 3.1.2

Spring Cloud Version : 2022.0.4

GraalVM Version: 17

My Project Github Link : graalvm-spring-cloud-example-project

My Code:

@Service("listenPersonData")
public class PersonListener implements Consumer<Person> {

    @Override
    public void accept(Person person) {
        System.out.println("Person Received : " + person.getName());
    }
}

Application.yml

spring:
  cloud:
    stream:
      kafka:
        binder:
          replication-factor: 2
      bindings:
        listenPersonData-in-0:
          destination: deneme-person-topic-2
          binder: kafka1
          group: omer-celik-2243
      function:
        definition: listenPersonData;
      binders:
        kafka1:
          type: kafka
          environment:
            spring:
              cloud:
                stream:
                  kafka:
                    binder:
                      brokers: localhost:19092
                      autoCreateTopics: true


management:
  endpoints:
    web:
      exposure:
        include: "*"

reflect-config.json

[
  {
    "condition": {
      "typeReachable": "org.springframework.kafka.security.jaas.KafkaJaasLoginModuleInitializer"
    },
    "name": "sun.security.provider.ConfigFile",
    "allPublicConstructors": true
  },
  {
    "name": "org.springframework.cloud.stream.binding.InputBindingLifecycle",
    "allDeclaredFields": true
  },
  {
    "name": "org.springframework.cloud.stream.binding.OutputBindingLifecycle",
    "allDeclaredFields": true
  }
]

Docker Image: spring-boot:build-image -P native

Error:

2023-08-08T17:55:58.544Z  WARN 1 --- [           main] o.s.c.support.GenericApplicationContext  : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'binderClientFactoryCustomizer': Unexpected exception during bean creation
2023-08-08T17:55:58.544Z  WARN 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'inputBindingLifecycle'
2023-08-08T17:55:58.544Z  INFO 1 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : Removing {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2023-08-08T17:55:58.544Z  INFO 1 --- [           main] o.s.i.channel.PublishSubscribeChannel    : Channel 'application.errorChannel' has 0 subscriber(s).
2023-08-08T17:55:58.544Z  INFO 1 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : stopped bean '_org.springframework.integration.errorLogger'
2023-08-08T17:55:58.546Z  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2023-08-08T17:55:58.583Z ERROR 1 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

A component required a bean named 'outerContext' that could not be found.


Action:

Consider defining a bean named 'outerContext' in your configuration.
omerstack
  • 535
  • 9
  • 23
  • I am going to assume you have a sample project that reproduces the issue somewhere on GitHub. If so please share as it would be the fastest way for us to help you – Oleg Zhurakousky Aug 09 '23 at 07:12
  • Hello, my project is here : https://github.com/omercelikceng/graalvm-spring-cloud – omerstack Aug 09 '23 at 07:33

0 Answers0