org.springframework.beans.factory.BeanCreationException

tip

When kafka creates new consumers, it simply concatenate the name of your VM to generate the consumer id. So, your VM resolves localhost as the name of your VM, not whatever you had set. To solve, add kafka(or the name of VM) plus address to /etc/hosts

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • UnknownHostException kafka
    via Stack Overflow by noplay
    ,
  • Failed to get local hostname
    via GitHub by restart916
    ,
  • Unable to bind to 0.0.0.0 inside AWS VPC
    via Stack Overflow by LizH
    ,
    • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.dangdang.ddframe.job.spring.schedule.SpringJobScheduler#0': Invocation of init method failed; nested exception is com.dangdang.ddframe.job.exception.JobException: java.net.UnknownHostException: eplatmgmtbak: eplatmgmtbak: Temporary failure in name resolution at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1568)[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:540)[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229)[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:725)[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)[spring-context-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)[spring-context-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)[spring-context-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)[spring-context-4.1.1.RELEASE.jar:4.1.1.RELEASE] at com.dangdang.example.elasticjob.spring.main.SpringJobMain.main(SpringJobMain.java:31)[elastic-job-example-1.1.1.jar:na] Caused by: com.dangdang.ddframe.job.exception.JobException: java.net.UnknownHostException: eplatmgmtbak: eplatmgmtbak: Temporary failure in name resolution at com.dangdang.ddframe.job.internal.env.LocalHostService.getLocalHost(LocalHostService.java:103)[elastic-job-core-1.1.1.jar:na] at com.dangdang.ddframe.job.internal.env.LocalHostService.getHostName(LocalHostService.java:95)[elastic-job-core-1.1.1.jar:na] at com.dangdang.ddframe.job.internal.server.ServerService.persistServerOnline(ServerService.java:57)[elastic-job-core-1.1.1.jar:na] at com.dangdang.ddframe.job.internal.schedule.SchedulerFacade.registerStartUpInfo(SchedulerFacade.java:83)[elastic-job-core-1.1.1.jar:na] at com.dangdang.ddframe.job.internal.executor.JobExecutor.init(JobExecutor.java:88)[elastic-job-core-1.1.1.jar:na] at com.dangdang.ddframe.job.api.JobScheduler.init(JobScheduler.java:59)[elastic-job-core-1.1.1.jar:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.7.0_75] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[na:1.7.0_75] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[na:1.7.0_75] at java.lang.reflect.Method.invoke(Method.java:606)[na:1.7.0_75] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1696)[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1635)[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1564)[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] ... 12 more Caused by: java.net.UnknownHostException: eplatmgmtbak: eplatmgmtbak: Temporary failure in name resolution at java.net.InetAddress.getLocalHost(InetAddress.java:1473)[na:1.7.0_75] at com.dangdang.ddframe.job.internal.env.LocalHostService.getLocalHost(LocalHostService.java:101)[elastic-job-core-1.1.1.jar:na]

    Users with the same issue

    Unknown visitor1 times, last one,
    raj76
    2 times, last one,
    nasimk
    2 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    9 more bugmates