码迷,mamicode.com
首页 > 其他好文 > 详细

rocketmq生产者部署的机器注意事项

时间:2016-12-28 12:03:34      阅读:438      评论:0      收藏:0      [点我收藏+]

标签:.post   actor   port   service   sed   ini   defaults   one   proc   

报错:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘warningProducer‘: Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:396)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1505)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
        at com.alibaba.dubbo.container.spring.SpringContainer.start(SpringContainer.java:50)
        at com.alibaba.dubbo.container.Main.main(Main.java:80)
Caused by: java.lang.ExceptionInInitializerError
        at com.alibaba.rocketmq.client.impl.MQClientAPIImpl.<init>(MQClientAPIImpl.java:86)
        at com.alibaba.rocketmq.client.impl.factory.MQClientInstance.<init>(MQClientInstance.java:133)
        at com.alibaba.rocketmq.client.impl.MQClientManager.getAndCreateMQClientInstance(MQClientManager.java:51)
        at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.start(DefaultMQProducerImpl.java:175)
        at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.start(DefaultMQProducerImpl.java:160)
        at com.alibaba.rocketmq.client.producer.DefaultMQProducer.start(DefaultMQProducer.java:76)
        at cn.ximi.mq.producer.WarningProducer.init(WarningProducer.java:45)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:344)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:295)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:130)
        ... 15 more
Caused by: java.lang.RuntimeException: InetAddress java.net.InetAddress.getLocalHost() throws UnknownHostException
See https://github.com/alibaba/RocketMQ/issues/64 for further details.
        at com.alibaba.rocketmq.common.MixAll.localhost(MixAll.java:458)
        at com.alibaba.rocketmq.common.MixAll.<clinit>(MixAll.java:82)
        ... 29 more
Caused by: java.net.UnknownHostException: server-40: server-40
        at java.net.InetAddress.getLocalHost(InetAddress.java:1475)
        at com.alibaba.rocketmq.common.MixAll.localhost(MixAll.java:454)
        ... 30 more
Caused by: java.net.UnknownHostException: server-40
        at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
        at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1295)
        at java.net.InetAddress.getLocalHost(InetAddress.java:1471)
        ... 31 more

查看当前主机名:

hostname命令:

技术分享

 

在hosts中配置mq的master和slave(如果有slave):

技术分享

这样生产者服务就可以启动了。

rocketmq生产者部署的机器注意事项

标签:.post   actor   port   service   sed   ini   defaults   one   proc   

原文地址:http://www.cnblogs.com/gmq-sh/p/6228617.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!