delei opened a new issue, #3750:
URL: https://github.com/apache/hertzbeat/issues/3750
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Current Behavior
We attempted to upgrade our Docker Compose environment from version `v1.7.2`
to `v1.7.3`, but the service failed to start. The primary content of the error
log is as follows:
```bash
2025-09-06 21:58:04.283 [main] ERROR
org.springframework.boot.SpringApplication Line:857 - Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'chatController' defined in URL
[jar:file:/opt/hertzbeat/lib/hertzbeat-ai-agent-2.0-SNAPSHOT.jar!/org/apache/hertzbeat/ai/agent/controller/ChatController.class]:
Unsatisfied dependency expressed through constructor parameter 0: Error
creating bean with name 'openAiChatClient' defined in class path resource
[org/apache/hertzbeat/ai/agent/config/LlmConfig.class]: Unsatisfied dependency
expressed through method 'openAiChatClient' parameter 0: Error creating bean
with name 'openAiChatModel' defined in class path resource
...
```
We have discovered that the `conf/application.yml` configuration file within
Docker Compose is not the latest version.
### Expected Behavior
Deployment or upgrade using Docker Compose version 1.7.3 was successful.
### Steps To Reproduce
_No response_
### Environment
```markdown
HertzBeat version(s): 1.7.3
```
### Debug logs
2025-09-06 21:58:04.283 [main] ERROR
org.springframework.boot.SpringApplication Line:857 - Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'chatController' defined in URL
[jar:file:/opt/hertzbeat/lib/hertzbeat-ai-agent-2.0-SNAPSHOT.jar!/org/apache/hertzbeat/ai/agent/controller/ChatController.class]:
Unsatisfied dependency expressed through constructor parameter 0: Error
creating bean with name 'openAiChatClient' defined in class path resource
[org/apache/hertzbeat/ai/agent/config/LlmConfig.class]: Unsatisfied dependency
expressed through method 'openAiChatClient' parameter 0: Error creating bean
with name 'openAiChatModel' defined in class path resource
[org/springframework/ai/model/openai/autoconfigure/OpenAiChatAutoConfiguration.class]:
Failed to instantiate [org.springframework.ai.openai.OpenAiChatModel]: Factory
method 'openAiChatModel' threw exception with message: OpenAI API key must be
set. Use the connection property: spring.ai.openai.api-key or
spring.ai.openai.chat.api-key property.
at
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:804)
at
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:240)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1381)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1218)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:563)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523)
at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:307)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.instantiateSingleton(DefaultListableBeanFactory.java:1122)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingleton(DefaultListableBeanFactory.java:1093)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:1030)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:987)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:627)
at
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
at
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:318)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1361)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1350)
at org.apache.hertzbeat.manager.Manager.main(Manager.java:48)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'openAiChatClient' defined in class path resource
[org/apache/hertzbeat/ai/agent/config/LlmConfig.class]: Unsatisfied dependency
expressed through method 'openAiChatClient' parameter 0: Error creating bean
with name 'openAiChatModel' defined in class path resource
[org/springframework/ai/model/openai/autoconfigure/OpenAiChatAutoConfiguration.class]:
Failed to instantiate [org.springframework.ai.openai.OpenAiChatModel]: Factory
method 'openAiChatModel' threw exception with message: OpenAI API key must be
set. Use the connection property: spring.ai.openai.api-key or
spring.ai.openai.chat.api-key property.
at
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:804)
at
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:546)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1361)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1191)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:563)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523)
at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:307)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1573)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1519)
at
org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:913)
at
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
... 21 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'openAiChatModel' defined in class path resource
[org/springframework/ai/model/openai/autoconfigure/OpenAiChatAutoConfiguration.class]:
Failed to instantiate [org.springframework.ai.openai.OpenAiChatModel]: Factory
method 'openAiChatModel' threw exception with message: OpenAI API key must be
set. Use the connection property: spring.ai.openai.api-key or
spring.ai.openai.chat.api-key property.
at
org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:657)
at
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:645)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1361)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1191)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:563)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523)
at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:307)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1631)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1519)
at
org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:913)
at
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
... 34 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to
instantiate [org.springframework.ai.openai.OpenAiChatModel]: Factory method
'openAiChatModel' threw exception with message: OpenAI API key must be set. Use
the connection property: spring.ai.openai.api-key or
spring.ai.openai.chat.api-key property.
at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.lambda$instantiate$0(SimpleInstantiationStrategy.java:199)
at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiateWithFactoryMethod(SimpleInstantiationStrategy.java:88)
at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:168)
at
org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
... 48 common frames omitted
Caused by: java.lang.IllegalArgumentException: OpenAI API key must be set.
Use the connection property: spring.ai.openai.api-key or
spring.ai.openai.chat.api-key property.
at org.springframework.util.Assert.hasText(Assert.java:253)
at
org.springframework.ai.model.openai.autoconfigure.OpenAIAutoConfigurationUtil.resolveConnectionProperties(OpenAIAutoConfigurationUtil.java:58)
at
org.springframework.ai.model.openai.autoconfigure.OpenAiChatAutoConfiguration.openAiApi(OpenAiChatAutoConfiguration.java:100)
at
org.springframework.ai.model.openai.autoconfigure.OpenAiChatAutoConfiguration.openAiChatModel(OpenAiChatAutoConfiguration.java:77)
at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.lambda$instantiate$0(SimpleInstantiationStrategy.java:171)
... 51 common frames omitted
### Anything else?
We should update the configuration file in `script/docker-compose` or add a
description of the configuration file changes to the documentation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]