disconf配置文件获取失败

简介:
启动程序报错:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springPropertyConfigurer' defined in URL [jar:file:/home/fightfaith/develop/tomcat/webapps/cc-manage-web/WEB-INF/lib/cc-manage-resource-0.0.1.jar!/applicationContext.xml]: Cannot resolve reference to bean 'configproperties_no_reloadable_disconf' while setting bean property 'propertiesArray' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configproperties_no_reloadable_disconf' defined in URL [jar:file:/home/fightfaith/develop/tomcat/webapps/cc-manage-web/WEB-INF/lib/cc-manage-resource-0.0.1.jar!/applicationContext.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [manage_static.properties] cannot be opened because it does not exist
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:382)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:157)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1531)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:149)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524)
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configproperties_no_reloadable_disconf' defined in URL [jar:file:/home/fightfaith/develop/tomcat/webapps/cc-manage-web/WEB-INF/lib/cc-manage-resource-0.0.1.jar!/applicationContext.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [manage_static.properties] cannot be opened because it does not exist
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
	... 26 more
Caused by: java.io.FileNotFoundException: class path resource [manage_static.properties] cannot be opened because it does not exist
	at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
	at org.springframework.core.io.support.EncodedResource.getInputStream(EncodedResource.java:154)
	at org.springframework.core.io.support.PropertiesLoaderUtils.fillProperties(PropertiesLoaderUtils.java:98)
	at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:175)
	at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:156)
	at com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean.doReload(ReloadablePropertiesFactoryBean.java:228)
	at com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean.reload(ReloadablePropertiesFactoryBean.java:218)
	at com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean.createMyInstance(ReloadablePropertiesFactoryBean.java:169)
	at com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean.createProperties(ReloadablePropertiesFactoryBean.java:148)
	at org.springframework.beans.factory.config.PropertiesFactoryBean.afterPropertiesSet(PropertiesFactoryBean.java:71)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
	... 33 more

之前有一次是因为disconf的配置文件要下载并写入到本地, 然后对要写入的文件夹没有写入权限导致, 这次首先查看了一下tomcat配置:

目录...../cc-manage是肯定有写入权限的, 所以不是写入权限的问题.

访问disconf:
发现是502网关错误, 找到disconf的nginx配置:
    server {
        listen   80;
        server_name disconf.***.net;
        access_log /server/logs/disconf.***.net-access.log;
        error_log /server/logs/disconf.***.net-error.log;
        location / {
            root /home/***/disconf/war/html;
            if ($query_string) {
                expires max;
            }
        }
        location ~ ^/(api|export) {
            allow 182.50.***.103;
            allow 114.242.***.86;
            allow 192.168.0.1;
            #deny all;
            proxy_pass_header Server;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Scheme $scheme;
            proxy_pass http://192.168.0.49:8080;
        }
    }

查看disconf错误日志:
2018/08/01 11:10:13 [error] 21087#21087: *3441 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.253, server: disconf.btzh.net, request: "GET /api/config/file?version=1_0_0_0&app=cc-manage-web&env=online&key=manage_static.properties&type=0 HTTP/1.1", upstream: "http://192.168.0.49:8080/api/config/file?version=1_0_0_0&app=cc-manage-web&env=online&key=manage_static.properties&type=0", host: "disconf.btzh.net"
2018/08/01 11:11:25 [error] 21087#21087: *3464 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.253, server: disconf.btzh.net, request: "GET /api/account/session HTTP/1.1", upstream: "http://192.168.0.49:8080/api/account/session", host: "disconf.btzh.net", referrer: "http://disconf.btzh.net/"
2018/08/01 11:11:42 [error] 21087#21087: *3469 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.253, server: disconf.btzh.net, request: "GET /api/account/session HTTP/1.1", upstream: "http://192.168.0.49:8080/api/account/session", host: "disconf.btzh.net", referrer: "http://disconf.btzh.net/login.html"
vi2018/08/01 11:32:18 [error] 21086#21086: *3862 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.253, server: disconf.btzh.net, request: "GET /api/account/session HTTP/1.1", upstream: "http://192.168.0.49:8080/api/account/session", host: "disconf.btzh.net", referrer: "http://disconf.btzh.net/main.html"
2018/08/01 11:32:18 [error] 21086#21086: *3863 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.253, server: disconf.btzh.net, request: "GET /api/app/list HTTP/1.1", upstream: "http://192.168.0.49:8080/api/app/list", host: "disconf.btzh.net", referrer: "http://disconf.btzh.net/main.html"
2018/08/01 11:32:18 [error] 21086#21086: *3862 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.253, server: disconf.btzh.net, request: "GET /api/env/list HTTP/1.1", upstream: "http://192.168.0.49:8080/api/env/list", host: "disconf.btzh.net", referrer: "http://disconf.btzh.net/main.html"
2018/08/01 11:32:18 [error] 21086#21086: *3860 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.253, server: disconf.btzh.net, request: "GET /api/account/session HTTP/1.1", upstream: "http://192.168.0.49:8080/api/account/session", host: "disconf.btzh.net", referrer: "http://disconf.btzh.net/login.html"
2018/08/01 11:34:00 [error] 21086#21086: *3894 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.253, server: disconf.btzh.net, request: "GET /api/zoo/hosts HTTP/1.1", upstream: "http://192.168.0.49:8080/api/zoo/hosts", host: "disconf.btzh.net"
2018/08/01 11:34:02 [error] 21086#21086: *3896 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.253, server: disconf.btzh.net, request: "GET /api/config/file?version=1_0_0_0&app=cc-manage-web&env=online&key=manage_config.properties&type=0 HTTP/1.1", upstream: "http://192.168.0.49:8080/api/config/file?version=1_0_0_0&app=cc-manage-web&env=online&key=manage_config.properties&type=0", host: "disconf.btzh.net"
2018/08/01 11:34:04 [error] 21086#21086: *3899 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.253, server: disconf.btzh.net, request: "GET /api/config/file?version=1_0_0_0&app=cc-manage-web&env=online&key=manage_static.properties&type=0 HTTP/1.1", upstream: "http://192.168.0.49:8080/api/config/file?version=1_0_0_0&app=cc-manage-web&env=online&key=manage_static.properties&type=0", host: "disconf.btzh.net"
2018/08/01 11:34:09 [error] 21086#21086: *3903 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.253, server: disconf.btzh.net, request: "GET /api/zoo/hosts HTTP/1.1", upstream: "http://192.168.0.49:8080/api/zoo/hosts", host: "disconf.btzh.net"
2018/08/01 11:34:11 [error] 21086#21086: *3905 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.253, server: disconf.btzh.net, request: "GET /api/config/file?version=1_0_0_0&app=cc-manage-web&env=online&key=manage_config.properties&type=0 HTTP/1.1", upstream: "http://192.168.0.49:8080/api/config/file?version=1_0_0_0&app=cc-manage-web&env=online&key=manage_config.properties&type=0", host: "disconf.btzh.net"
2018/08/01 11:34:13 [error] 21086#21086: *3907 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.253, server: disconf.btzh.net, request: "GET /api/config/file?version=1_0_0_0&app=cc-manage-web&env=online&key=manage_static.properties&type=0 HTTP/1.1", upstream: "http://192.168.0.49:8080/api/config/file?version=1_0_0_0&app=cc-manage-web&env=online&key=manage_static.properties&type=0", host: "disconf.btzh.net"

日志提到访问49机器端口8080/api/接口失败, 到49机器:
root@mach9:/server/logs# ps -ef|grep tomcat
root      7213  2033  0 11:38 pts/0    00:00:00 grep --color=auto tomcat

怀疑tomcat进程死掉的原因, 启动tomcat:
root@mach9:/usr/local/apache-tomcat-8.0.35/bin# ./startup.sh 
Using CATALINA_BASE:   /usr/local/apache-tomcat-8.0.35
Using CATALINA_HOME:   /usr/local/apache-tomcat-8.0.35
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.0.35/temp
Using JRE_HOME:        /usr/local/jdk1.8.0_91
Using CLASSPATH:       /usr/local/apache-tomcat-8.0.35/bin/bootstrap.jar:/usr/local/apache-tomcat-8.0.35/bin/tomcat-juli.jar
Tomcat started.

disconf访问成功, 项目启动成功.
目录
相关文章
|
13天前
|
Java 数据库连接 数据库
springboot启动配置文件-bootstrap.yml常用基本配置
以上是一些常用的基本配置项,在实际应用中可能会根据需求有所变化。通过合理配置 `bootstrap.yml`文件,可以确保应用程序在启动阶段加载正确的配置,并顺利启动运行。
25 2
|
5月前
|
Java 数据库连接 Linux
蓝易云 - Nacos启动常见报错解决方法
以上就是Nacos启动时可能遇到的一些常见问题及其解决方案。希望能帮助你顺利启动Nacos。
691 0
|
6月前
|
数据库
【SSM】如何修改配置文件重启项目
【SSM】如何修改配置文件重启项目
36 1
|
6月前
|
API Nacos 数据库
Nacos配置问题之启动项目报错如何解决
Nacos是一个开源的、易于部署的动态服务发现、配置管理和服务管理平台,旨在帮助微服务架构下的应用进行快速配置更新和服务治理;在实际运用中,用户可能会遇到各种报错,本合集将常见的Nacos报错问题进行归纳和解答,以便使用者能够快速定位和解决这些问题。
2761 11
|
6月前
|
缓存 Java 网络安全
Nacos报错问题之获取配置文件的时候报错如何解决
Nacos是一个开源的、易于部署的动态服务发现、配置管理和服务管理平台,旨在帮助微服务架构下的应用进行快速配置更新和服务治理;在实际运用中,用户可能会遇到各种报错,本合集将常见的Nacos报错问题进行归纳和解答,以便使用者能够快速定位和解决这些问题。
|
存储 SpringCloudAlibaba 数据可视化
SpringCloudAliBaba之Nacos配置中心:轻松管理配置文件
SpringCloudAliBaba之Nacos配置中心:轻松管理配置文件
1814 0
|
6月前
|
开发工具 git 微服务
【二十三】搭建SpringCloud项目六(Config)配置中心动态刷新
【二十三】搭建SpringCloud项目六(Config)配置中心动态刷新
70 0
QGS
|
6月前
|
JSON Java 关系型数据库
手拉手Springboot获取yml配置文件信息
手拉手Springboot获取yml配置文件信息
QGS
94 1
|
6月前
|
安全 前端开发 Java
Nacos常见问题之如何取得配置文件
Nacos是一款易于使用的动态服务发现、配置管理和服务管理平台,针对不同版本可能出现的兼容性和功能问题,本汇总贴心整理了用户在使用Nacos时可能遇到的版本相关问题及答案,以便用户能够更顺畅地进行服务治理和配置管理。
362 0
|
Java 容器
SpringBoot中的yml文件中读取自定义配置信息
SpringBoot中的yml文件中读取自定义配置信息
184 0