1. 程式人生 > >centos7 安裝dubbo-admin管理遇到的問題總結

centos7 安裝dubbo-admin管理遇到的問題總結

具體的安裝過程,網上一堆。這裡說明一下我安裝過程中遇到的問題。

一、dubbo-admin-2.5.4-SNAPSHOT.war包的問題,由於linux系統下安裝的是jdk1.8版本,所以要解決jdk1.8版本的問題。

如果嫌麻煩,只好將linux下的jdk環境配置成1.7的,錯誤內容如下:

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)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:287)

如果非要使用jdk1.8,那麼網路上提供的辦法是修改dubbo-admin  的pom配置檔案

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 以下的依賴就行。然後執行正常了。


二、對映配置錯誤,在啟動tomcat的時候,會出現這樣的錯誤。

 INFO velocity.VelocityEngine - SpringResourceLoaderAdapter : initialization starting.
 INFO velocity.VelocityEngine - SpringResourceLoaderAdapter : set path '/templates/common/'
 INFO velocity.VelocityEngine - SpringResourceLoaderAdapter : initialization complete.
 INFO rule.ExtensionMappingRule - Initialized extension.input:ExtensionMappingRule with cache disabled
 INFO rule.ExtensionMappingRule - Initialized extension.output:ExtensionMappingRule with cache disabled
 INFO rule.DirectModuleMappingRule - Initialized action:DirectModuleMappingRule with cache disabled
 INFO rule.DirectModuleMappingRule - Initialized screen.notemplate:DirectModuleMappingRule with cache disabled
 INFO rule.FallbackModuleMappingRule - Initialized screen:FallbackModuleMappingRule with cache enabled
 INFO rule.DirectTemplateMappingRule - Initialized screen.template:DirectTemplateMappingRule with cache disabled
 INFO rule.FallbackTemplateMappingRule - Initialized layout.template:FallbackTemplateMappingRule with cache enabled
 INFO rule.DirectModuleMappingRule - Initialized control.notemplate:DirectModuleMappingRule with cache disabled
 INFO rule.FallbackModuleMappingRule - Initialized control:FallbackModuleMappingRule with cache enabled
 INFO rule.DirectTemplateMappingRule - Initialized control.template:DirectTemplateMappingRule with cache disabled
 INFO zkclient.ZkEventThread - Starting ZkClient event thread.

解決辦法:

root賬戶  修改  vi /etc/hosts 配置檔案,檢視IP對映的別名是否錯誤。

到tomcat 的webapps 的ROOT/WEB-INF/dubbo.properties檔案,檢視配置的IP是否一致

最後檢視zoo.cfg裡面配置的server.1=jet-02:2888:3888(紅色對映的別名是否與hosts配置檔案的別名對應上)。

三、設定duboo-admin-tomcat與zookeeper開機啟動

root賬戶  vi /ect/rc.local  新增(jet為你的使用者名稱稱)

su - jet -c '/home/jet/softfix/zookeeper/zookeeper-3.4.9/bin/zkServer.sh start'
su - jet -c '/home/jet/softfix/dubbo-admin-tomcat/bin/startup.sh'