dubbo-admin 在linux 、jdk8 、tomcat7中部署问题总结

来源:互联网 发布:c语言switch case语句 编辑:程序博客网 时间:2024/05/20 08:27

经过了几番的痛苦,虽然阿里的dubbo 已经对jdk 8 做出了比较好的兼容,但是还是痛苦了一番,为了让大家引以为戒,特写此篇文章

首先访问 https://github.com/alibaba/dubbo 去下载dubbo ,但是我们用到的只有dubbo-admin,

个人建议用eclipse 或者myeclipse 等clone 一份下来到工具中,方便修改内容(还有我直接下载的用windows 中的打包一直不成功)

 1、打包

①在windows 中进行打包,打开cmd 进入dubbo 中的dubbo-admin文件夹中,然后输入mvn -Dmaven.skip.test=true,输入完成之后会在dubbo-admin/target 下产生dubbo-admin.war 将其拷贝到已经安装好的tomcat 中运行即可,运行开始后进入到tomcat 中的logs 下 输入tail -f catalina.out 观看日志

②用eclipse 打包(我选用的此方法),clone 下来之后只是修改WEB-INF 下的dubbo.properties 中的zookeeper 地址,其他无需进行修改,使用maven 的package 或者install 命令都可进行打包

③下载也可以直接下载我已经打包好的可直接使用的dubbo-admin

下载地址:http://download.csdn.net/download/qq_33363618/10113990

2、部署

①、我的环境是linux 7 ,jdk1.8.144, tomcat 7 .zookeeper 3.4.9

②、如果出现问题,可进入github 中dubbo 的issues 中先进行查看,地址为https://github.com/alibaba/dubbo/issues

3.问题

①、在2.5.4 初版本时大家都在说的问题就是不支持jdk1.8 的问题,如果你的版本是2.4版本以上的(笔者此时的版本为2.5.7)则不存在jdk8 中运行出错的问题

②、如果出现

ERROR context.ContextLoader - Context initialization failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uriBrokerService': Cannot create inner bean '(inner bean)' of type [com.alibaba.citrus.service.uribroker.impl.URIBrokerServiceImpl$URIBrokerInfo] while setting bean property 'brokers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#25': Cannot create inner bean 'server' of type [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'server': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'URIType' of bean class [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]: Bean property 'URIType'is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:230)        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122)        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:287)
请参考https://github.com/alibaba/dubbo/issues/50,但是现在这些问题都已经修复,如果还是出现,请详细检查出现的错误
下载并运行我给出的war 包不会出现这样的问题
③、出现java.net.UnknownHostException: bogon: bogon: δ֪                                                at java.net.InetAddress.getLocalHost(InetAddress.java:1505)        at com.alibaba.dubbo.common.utils.NetUtils.getLocalAddress0(NetUtils.java:195)        at com.alibaba.dubbo.common.utils.NetUtils.getLocalAddress(NetUtils.java:182)        at com.alibaba.dubbo.common.utils.NetUtils.getLocalHost(NetUtils.java:148)        at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:324)        at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:161)        at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:65)
Caused by: java.net.UnknownHostException: bogon:                                                         at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)        at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)        at java.net.InetAddress.getLocalHost(InetAddress.java:1500)        ... 44 more
则需要在/etc/hosts 文件中对地址进行映射, 执行命令 vi /etc/hosts 在最后输入  本机ip地址 未知名
如192.168.110.128 bogon
④、如果出现什么类NoClassFoundException 异常,那么有可能是你本机的maven 仓库中没有加载完整的jar包,检验方法:在项目中找到对应的jar 包按照全类名找到此类,然后点开箭头查看是否类中有方法等信息
如下即可:
其他zookeeper 等部署信息可自行百度,谢谢观看