我试图使用argocd部署一个spring应用程序的Kubernetes集群,但我在其中遇到了错误。我首先使用GitLab ci管道构建docker映像,然后使用argocd进行连续部署。错误是:
Springapi error logs
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-05-25 16:24:33.389 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'consentDataController': Unsatisfied dependency expressed through field 'ipScoreService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IPScoreService': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'application-flags.load-ip-db-in-memory' in value "${application-flags.load-ip-db-in-memory}"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1413) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.9.jar!/:5.3.9]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.9.jar!/:5.3.9]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.4.jar!/:2.5.4]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.5.4.jar!/:2.5.4]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-2.5.4.jar!/:2.5.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.4.jar!/:2.5.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-2.5.4.jar!/:2.5.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[spring-boot-2.5.4.jar!/:2.5.4]
at com.dronapay.api.ApiApplication.main(ApiApplication.java:13) ~[classes!/:0.0.1-SNAPSHOT]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[api.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[api.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[api.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[api.jar:0.0.1-SNAPSHOT]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IPScoreService': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'application-flags.load-ip-db-in-memory' in value "${application-flags.load-ip-db-in-memory}"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1413) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657) ~[spring-beans-5.3.9.jar!/:5.3.9]
... 28 common frames omitted
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'application-flags.load-ip-db-in-memory' in value "${application-flags.load-ip-db-in-memory}"
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:180) ~[spring-core-5.3.9.jar!/:5.3.9]
at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126) ~[spring-core-5.3.9.jar!/:5.3.9]
at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:239) ~[spring-core-5.3.9.jar!/:5.3.9]
at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[spring-core-5.3.9.jar!/:5.3.9]
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:936) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1321) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.9.jar!/:5.3.9]
... 39 common frames omitted
我没有得到任何解决这个问题的方法,如果有人对此有任何想法,请回复。
这是我的配置文件:
这是我的申请。配置所有内容的yml文件。
config:
activate:
on-profile: prod
datasource:
URL: <DB_HOST>
username: <DBUSER>
password: <DBPWD>
hikari:
minimimIdle: 2
maximumPoolSize: 10
idleTimeout: 300000
maxLifetime: 2000000
connectionTimeout: 30000
redis:
host: <Redis_Host>
port: 6379
database: 0
password: <pass>
timeout: 60000
jpa:
open-in-view: true
show-sql: false
generate-ddl: false
database-platform: org.hibernate.dialect.PostgreSQLDialect
hibernate:
naming:
implicit-strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
dialect: org.hibernate.dialect.PostgreSQLDialect
ddl-auto: none
servlet:
multipart:
max-file-size: 3MB
server:
port: 8080
error:
include-message: always
kafka:
#bootstrap-servers: localhost:19092
bootstrap-servers: <kafka_bootstrap_host>:9092
consumer:
group-id: "api"
ingress-topic: ingress
egress-topic: scored
lists-topic: listed
file-upload-path: /mnt/d/docker_data/uploaded
auth:
apikey: false
apikeyfile: apikey.txt
application-flags:
kafka: false
double-debit: false
load-ip-db-in-memory: false
logging:
config: /mnt/d/docker_data/logback.xml
谢谢
@值(“${应用程序标志。在内存中加载ip db}”)
如果错误,则为空检查
或者,您可以使用@Value("${application-flags.load-ip-db-in-内存:此处默认值,如果它不在app.prop}")私有字符串某个默认值;
此问题可能由不同的原因引起。
${application-flags.load-ip-db-in-内存}
中提供变量,则您执行的当前终端java-jar
3、如注释中所述,您可以为该异常设置默认值。
我运行< code>heroku open时出现应用程序错误。我查了日志,这是: 2016-06-19T05:22:44.640391 00:00 heroku[路由器]:at=错误代码=H10 desc=“应用程序崩溃”方法=获取路径=“/”主机=drawparty-.herokuapp。com request_id=6712804b-95f9-49ce-92a5-7f45df7bb79e fw
我正试图将我的spring应用程序部署到heroku,但我相信maven插件中存在一些错误。尝试了所有可能的版本组合,在本地工作,但在部署时不工作。 当我跑步的时候: git push heroku master 以下是错误: 4.0.0 org.springframework.Boot Spring-Boot-starter-parent 2.3.3.发布com.project techupda
我使用Netbeans创建了带有ejb模块和war模块的Java企业应用程序。我对战争模块做了一些改动,一切正常。但现在我正在尝试调用ejb模块中定义的远程ejb。我已经学习了本教程https://netbeans.org/kb/docs/javaee/entappclient.html。现在,当我尝试在应用服务器(JBossAS7)中部署ear文件时,我得到以下错误: {“JBAS014653:
我在spring boot(v1.5.9.release)中开发了应用程序,该应用程序与Tomcatv7.0一起工作 如何解决此问题?因为我不知道是哪个特定的依赖项导致了这个问题,我需要在哪里添加排除。请帮帮忙。
尝试在Heroku云中部署Spring Boot应用程序,但编译java应用程序时出现错误,但在我的本地计算机中运行良好。
我知道Spring Boot应用程序可以作为war文件部署到生产环境中。但是部署spring boot应用程序的典型方式是什么?它只需要jvm而不需要容器吗?