Hi, getting the following error when trying to register server to eureka -

2019-06-20 10:16:30.642 [ERROR] [main] [org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration:120] 
error getting CloudEurekaClient org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'scopedTarget.eurekaClient' defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.class]: 
Bean instantiation via factory method failed; 
nested exception is org.springframework.beans.BeanInstantiationException: 
Failed to instantiate [com.netflix.discovery.EurekaClient]: Factory method 'eurekaClient' threw exception;
 nested exception is java.lang.RuntimeException:
 Failed to initialize DiscoveryClient!
 at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:627) 
 at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:607) 
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321) 
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) 
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) 
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) 
 at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$1(AbstractBeanFactory.java:356) 
 at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:389) 
 at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.java:186) 
 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:353) 
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) 
 at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35) 
 at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getTargetObject(EurekaRegistration.java:129) 
 at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getEurekaClient(EurekaRegistration.java:117) 
 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.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) 
 at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.invoke(GenericScope.java:499) 
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) 
 at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) 
 at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration$$EnhancerBySpringCGLIB$$b156ec7e.getEurekaClient(<generated>) 
 at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.maybeInitializeClient(EurekaServiceRegistry.java:57) 
 at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.register(EurekaServiceRegistry.java:38) 
 at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaAutoServiceRegistration.start(EurekaAutoServiceRegistration.java:83) 
 at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) 
 at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) 
 at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) 
 at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) 
 at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122) 
 at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:893) 
 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:161) 
 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) 
 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) 
 at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742) 
 at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389) 
 at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) 
 at com.bo.operators.OperatorsWebApplication.main(OperatorsWebApplication.java:25) 
 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.boot.loader.MainMethodRunner.run(MainMethodRunner.java:47) 
 at org.springframework.boot.loader.Launcher.launch(Launcher.java:86) 
 at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) 
 at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) 
 Caused by: org.springframework.beans.BeanInstantiationException: 
 Failed to instantiate [com.netflix.discovery.EurekaClient]: 
 Factory method 'eurekaClient' threw exception; 
 nested exception is java.lang.RuntimeException: 
 Failed to initialize DiscoveryClient! 
 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) 
 at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622) ... 
 46 common frames omitted Caused by: java.lang.RuntimeException: 
 Failed to initialize DiscoveryClient! 
 at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:411) 
 at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:269) 
 at org.springframework.cloud.netflix.eureka.CloudEurekaClient.<init>(CloudEurekaClient.java:67) 
 at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.eurekaClient(EurekaClientAutoConfiguration.java:330) 
 at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration$$EnhancerBySpringCGLIB$$5c47663.CGLIB$eurekaClient$0(<generated>) 
 at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration$$EnhancerBySpringCGLIB$$5c47663$$FastClassBySpringCGLIB$$f69df780.invoke(<generated>) 
 at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) 
 at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
 at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration$$EnhancerBySpringCGLIB$$5c47663.eurekaClient(<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:154) ... 
 47 common frames omitted Caused by: java.lang.ExceptionInInitializerError: null 
 at com.netflix.discovery.converters.wrappers.CodecWrappers$XStreamXml.<init>(CodecWrappers.java:358) 
 at com.netflix.discovery.converters.wrappers.CodecWrappers.create(CodecWrappers.java:133) 
 at com.netflix.discovery.converters.wrappers.CodecWrappers.getEncoder(CodecWrappers.java:75) 
 at com.netflix.discovery.converters.wrappers.CodecWrappers.getEncoder(CodecWrappers.java:66) 
 at com.netflix.discovery.provider.DiscoveryJerseyProvider.<init>(DiscoveryJerseyProvider.java:77) 
 at com.netflix.discovery.shared.transport.jersey.EurekaJerseyClientImpl$EurekaJerseyClientBuilder$MyDefaultApacheHttpClient4Config.<init>(EurekaJerseyClientImpl.java:202) 
 at com.netflix.discovery.shared.transport.jersey.EurekaJerseyClientImpl$EurekaJerseyClientBuilder.build(EurekaJerseyClientImpl.java:178) 
 at com.netflix.discovery.shared.transport.jersey.JerseyEurekaHttpClientFactory$JerseyEurekaHttpClientFactoryBuilder.buildLegacy(JerseyEurekaHttpClientFactory.java:230)
 at com.netflix.discovery.shared.transport.jersey.JerseyEurekaHttpClientFactory$JerseyEurekaHttpClientFactoryBuilder.build(JerseyEurekaHttpClientFactory.java:204) 
 at com.netflix.discovery.shared.transport.jersey.JerseyEurekaHttpClientFactory.create(JerseyEurekaHttpClientFactory.java:161) 
 at com.netflix.discovery.shared.transport.jersey.Jersey1TransportClientFactories.newTransportClientFactory(Jersey1TransportClientFactories.java:59) 
 at com.netflix.discovery.DiscoveryClient.scheduleServerEndpointTask(DiscoveryClient.java:485) 
 at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:398) ... 
 60 common frames omitted Caused by: java.lang.NullPointerException: null 
 at com.thoughtworks.xstream.mapper.ClassAliasingMapper.addClassAlias(ClassAliasingMapper.java:37) 
 at com.thoughtworks.xstream.XStream.alias(XStream.java:1510) at com.thoughtworks.xstream.XStream.setupAliases(XStream.java:920) 
 at com.thoughtworks.xstream.XStream.<init>(XStream.java:590) at com.thoughtworks.xstream.XStream.<init>(XStream.java:514) 
 at com.thoughtworks.xstream.XStream.<init>(XStream.java:483) at com.thoughtworks.xstream.XStream.<init>(XStream.java:429) 
 at com.thoughtworks.xstream.XStream.<init>(XStream.java:396) at com.netflix.discovery.converters.XmlXStream.<init>(XmlXStream.java:51) 
 at com.netflix.discovery.converters.XmlXStream.<clinit>(XmlXStream.java:42) ... 
 73 common frames omitted 2019-06-20 10:16:30.746 [ERROR] [main] [org.springframework.boot.SpringApplication:821] 
 Application run failed org.springframework.context.ApplicationContextException: 
 Failed to start bean 'eurekaAutoServiceRegistration';
 nested exception is java.lang.NullPointerException 
 at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185) 
 at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) 
 at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) 
 at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) 
 at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122) 
 at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:893) 
 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:161) 
 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) 
 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) 
 at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742) 
 at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389) 
 at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) 
 at com.bo.operators.OperatorsWebApplication.main(OperatorsWebApplication.java:25) 
 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.boot.loader.MainMethodRunner.run(MainMethodRunner.java:47) 
 at org.springframework.boot.loader.Launcher.launch(Launcher.java:86) 
 at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) 
 at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) Caused by:
 java.lang.NullPointerException: null 
 at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.maybeInitializeClient(EurekaServiceRegistry.java:57) 
 at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.register(EurekaServiceRegistry.java:38) 
 at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaAutoServiceRegistration.start(EurekaAutoServiceRegistration.java:83) 
 at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ... 20 common frames omitted

after few minutes(10-15 minutes, it is able to connect)

seems like an issue with Xtream

Comment From: spencergibb

Please learn how to properly format code and logs.

If it is a problem with xstream you should report it upstream with eureka.

Comment From: itziklavon

really weird, i've checked java version on some server that it is working on without any issues, and the servers that having the issue, all are the same

Comment From: ryanjbaxter

Can you please format the exception so it is readable?

Comment From: itziklavon

Can you please format the exception so it is readable?

done

Comment From: itziklavon

Hi guys, any news?

Comment From: spencergibb

No

Comment From: spencergibb

Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

Comment From: itzikiusa

@spring-issuemaster @spencergibb issue was solved after moving to spring boot version 2.2.X and spring cloud version Hoxtox.SR1 currently i do not have logs for it unfortunately, sorry for the late response