我正在尝试使用Heroku运行spring-cloud hello world。我正在尝试使用工头,我得到以下stacktrace:
ERROR 6067 --- [main] o.s.boot.SpringApplication: Application startup failed
org.springframework.cloud.CloudException: No suitable cloud connector found
at org.springframework.cloud.CloudFactory.getCloud(CloudFactory.java:55)
at org.springframework.cloud.config.CloudScanHelper.initializeCloud(CloudScanHelper.java:85)
at org.springframework.cloud.config.CloudScanHelper.registerServiceBeans(CloudScanHelper.java:55)
at org.springframework.cloud.config.java.ServiceScanConfiguration.registerBeanDefinitions(ServiceScanConfiguration.java:22)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:336)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:149)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:122)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:318)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:692)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:322)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:962)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:951)
at com.trident.cloudexmachina.Application.main(Application.java:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:745)
我错过了“工头”连接器吗?
答案 0 :(得分:1)
好的,我会解释为什么我的问题是荒谬的,以及如何解决问题'。
首先,localconfig-connector项目中有一个spring-cloud-connectors。因此,您可以开始使用Spring应用程序"旧的方式"使用主类yadiyadiyada。
然而,它只能部分地解决问题,因为工头仍然应该用于本地启动应用程序"就像Heroku"一样。但是,您需要使用不同的Procfile或different.env文件来设置JAVA_OPTS,并使用localconfig-connector要求的-Dspring.cloud.appId = myappname,如下所示:
JAVA_OPTS=$JAVA_OPTS -Dspring.cloud.appId=myappname