zoukankan      html  css  js  c++  java
  • dubbo-admin 部署

    上一章主要是谈到zookeeper的安装和部署

    因为zookeeper只是一个黑框,我们无法看到是否存在了什么提供者或消费者,这时就要借助Dubbo-Admin管理平台来实时的查看,也可以通过这个平台来管理提者和消费者。

    dubbo-admin.war可以通过网上下载得到,但是我下载了很多版本,都不能使用,这个的原因大概是因为我们本地的jdk编译和打包的问题.所以最好的方式是由GITHUB上下载以后自己打包编译。另外本地一直要安装maven和JDK

    首先从github上下载dubbo-admin的源码,dubbo的所有源码可在上下载。

    使用命令 git clone https://github.com/alibaba/dubbo.git 

    或者直接在网站上使用Download zip的方式,如下图所示

    下载完成后进行解压,直接使用maven导入该项目:

    解压后的文件内容,这里你其它的都不用去管,只管导入dubbo-admin.

    使用maven命令进行eclipse:eclipse编译,编译完成后,

    然后到webapps/ROOT/WEB-INF下,有一个dubbo.properties文件,里面指向Zookeeper ,使用的是Zookeeper 的注册中心:

    dubbo.registry.address=zookeeper://127.0.0.1:2181
    dubbo.admin.root.password=root
    dubbo.admin.guest.password=guest
    

    将该几项调整为你本地的zookeeper地址后,  就可以直接在eclipse上直接导出war包了,然后将war包放到tomcat中的webapps目录下,

    这时一定要先启动zookeeper,之后再启动tomcat

    如果你的本地使用的是JDK1.8的话.启动tomcat可能会报以下错误:

    ERROR context.ContextLoader - Context initialization failed
    org.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 excepti
    on 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.fact
    ory.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)

    这时就需要你重新回到eclipse中修改POM文件

    找到pom.xml

    1、webx的依赖改为3.1.6版;

        <dependency>
            <groupId>com.alibaba.citrus</groupId>
            <artifactId>citrus-webx-all</artifactId>
            <version>3.1.6</version>
        </dependency>
    

    2、添加velocity的依赖,我用了1.7;

        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity</artifactId>
            <version>1.7</version>
        </dependency>
    

    3、对依赖项dubbo添加exclusion,避免引入旧spring

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>dubbo</artifactId>
            <version>${project.parent.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    

    4、webx已有spring 3以上的依赖,因此注释掉dubbo-admin里面的spring依赖

        <!--<dependency>-->
            <!--<groupId>org.springframework</groupId>-->
            <!--<artifactId>spring</artifactId>-->
        <!--</dependency>-->
    

    确定war包解压后lib目录没有spring 3 以下的依赖就行。然后运行正常了。

    此时再次打出war包后,输入正确的账号密码,就可以正常访问了.

  • 相关阅读:
    arcengine 文件夹连接
    [WinForm]DataGridView列头右键菜单
    Arcengine编辑代码
    map与pagelayout同步新方法
    清华教授李稻葵:恒昌、宜信过去三四年走过了西方国家20年的历程!
    delete
    股权融资与债务融资之区别 创业者一定要看懂
    《乌镇指数:全球人工智能发展报告2016》正式发布
    2017年美国名校录取中国大陆学生数据汇总
    IDG资本全球拼图:近10年揽26家独角兽,最敢出手VC再造"VC+"
  • 原文地址:https://www.cnblogs.com/moon521/p/5518972.html
Copyright © 2011-2022 走看看