这两天服务部署启动,突然不work,查看启动日志发现是redis初始化,出现了异常,导致应用启动失败
开始以为是redis的host配置出错,因为最近配置没有人改动,很奇怪
通过打印错误,发现redis的host和端口正常
于是通过打印的错误栈追踪源码,发现UnixResolverDnsServerAddressStreamProvider类去加载了/etc/resolv.conf,于是排查到这个dns解析文件中的配置,有一个ipv6的地址,这个地址是不存在的,把这个地址注释掉,继续启动应用,发现服务正常了
关于为什么没有去第一个ipv4的dns服务地址去解析,而去了第二个,猜想可能是第一个dns服务异常导致的
错误栈
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redissonClient' defined in class path resource [mx/smartmatrix/internal/config/CacheConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.redisson.api.RedissonClient]: Factory method 'redissonClient' threw exception; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1181)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1075)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
... 54 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.redisson.api.RedissonClient]: Factory method 'redissonClient' threw exception; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 67 common frames omitted
Caused by: java.lang.ExceptionInInitializerError: null
at io.netty.resolver.dns.UnixResolverDnsServerAddressStreamProvider.parseSilently(UnixResolverDnsServerAddressStreamProvider.java:76)
at io.netty.resolver.dns.DnsServerAddressStreamProviders$1.provider(DnsServerAddressStreamProviders.java:57)
at io.netty.resolver.dns.DnsServerAddressStreamProviders$1.<init>(DnsServerAddressStreamProviders.java:36)
at io.netty.resolver.dns.DnsServerAddressStreamProviders.<clinit>(DnsServerAddressStreamProviders.java:34)
at org.redisson.connection.MasterSlaveConnectionManager.<init>(MasterSlaveConnectionManager.java:205)
at org.redisson.connection.MasterSlaveConnectionManager.<init>(MasterSlaveConnectionManager.java:157)
at org.redisson.connection.SingleConnectionManager.<init>(SingleConnectionManager.java:34)
at org.redisson.config.ConfigSupport.createConnectionManager(ConfigSupport.java:228)
at org.redisson.Redisson.<init>(Redisson.java:121)
at org.redisson.Redisson.create(Redisson.java:164)
at mx.smartmatrix.common.config.BaseCacheConfig.redissonClient(BaseCacheConfig.java:74)
at mx.smartmatrix.internal.config.CacheConfig$$EnhancerBySpringCGLIB$$d195d73.CGLIB$redissonClient$4(<generated>)
at mx.smartmatrix.internal.config.CacheConfig$$EnhancerBySpringCGLIB$$d195d73$$FastClassBySpringCGLIB$$a443df20.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
at mx.smartmatrix.internal.config.CacheConfig$$EnhancerBySpringCGLIB$$d195d73.redissonClient(<generated>)
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:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 68 common frames omitted
Caused by: java.lang.IllegalArgumentException: cannot use an unresolved DNS server address: [fe80::46ef:bfff:fe2e:aac5%ens33]:53
at io.netty.resolver.dns.DnsServerAddresses.sanitize(DnsServerAddresses.java:179)
at io.netty.resolver.dns.DnsServerAddresses.sequential(DnsServerAddresses.java:67)
at io.netty.resolver.dns.DefaultDnsServerAddressStreamProvider.<clinit>(DefaultDnsServerAddressStreamProvider.java:107)
... 89 common frames omitted
网友评论