1、安装好tomcat之后,
下载并且编译最新的dubbo-admin 如图:
1、修改WEB-INF中的dubbo.properties
dubbo.registry.address=zookeeper://192.168.1.87:2181//zookeeper的地址
dubbo.admin.root.password=root
dubbo.admin.guest.password=guest
2、删除原tomcat/webapps/ROOT目录下的所有文件,同时复制dubbo-admin解压后的内容到tomcat/webapps/ROOT中
3、启动tomcat
4、访问对应的ip地址
如果出现:
INFOcontext.InheritableListablebeanfactory-Destroyingsingletonsincom.alibaba.citrus.springext.support.context.InheritableListablebeanfactory@55af05cd:definingbeans[org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalrequiredAnnotationProcessor,com.alibaba.citrus.service.configuration.support.PropertyPlaceholderConfigurer#0,templateService,mappingRuleService,dataResolverService,exceptionPipeline,resourceLoadingService,messageSource,uriBrokerService,restfulRewrite,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,dubbo-admin,com.alibaba.dubbo.config.RegistryConfig,registryService,configService,consumerService,overrideService,ownerService,providerService,routeService,userService,governanceCache,productionModeSensiblePostProcessor,webxConfiguration,requestContexts,com.alibaba.citrus.service.requestcontext.impl.RequestContextbeanfactoryPostProcessor#0,uploadService,pullService,formService,module.screen.Error404,module.screen.ErrorOther,moduleLoaderService,messageResourceService,com.alibaba.citrus.webx.context.WebxComponentsLoader$WebxComponentsCreator];rootoffactoryhierarchy ERRORcontext.ContextLoader-ContextinitializationFailed org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'uriBrokerService':Cannotcreateinnerbean'(innerbean)'oftype[com.alibaba.citrus.service.uribroker.impl.URIBrokerServiceImpl$URIBrokerInfo]whilesettingbeanproperty'brokers'withkey[0];nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'(innerbean)#25':Cannotcreateinnerbean'server'oftype[com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]whilesettingconstructorargument;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'server':Errorsettingpropertyvalues;nestedexceptionisorg.springframework.beans.NotWritablePropertyException:Invalidproperty'URIType'ofbeanclass[com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]:Beanproperty'URIType'isnotwritableorhasaninvalidsettermethod.Doestheparametertypeofthesettermatchthereturntypeofthegetter? atorg.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:230) atorg.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122) atorg.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:287) atorg.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:126) atorg.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.applyPropertyValues(AbstractAutowireCapablebeanfactory.java:1245) atorg.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.populateBean(AbstractAutowireCapablebeanfactory.java:1010) 142) atjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) atjava.lang.Thread.run(Thread.java:745) Causedby:org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'(innerbean)#25':Cannotcreateinnerbean'server'oftype[com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]whilesettingconstructorargument;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'server':Errorsettingpropertyvalues;nestedexceptionisorg.springframework.beans.NotWritablePropertyException:Invalidproperty'URIType'ofbeanclass[com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]:Beanproperty'URIType'isnotwritableorhasaninvalidsettermethod.Doestheparametertypeofthesettermatchthereturntypeofthegetter? atorg.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:230) atorg.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:117) atorg.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:479) atorg.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:219) ...34more Causedby:org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'server':Errorsettingpropertyvalues;nestedexceptionisorg.springframework.beans.NotWritablePropertyException:Invalidproperty'URIType'ofbeanclass[com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]:Beanproperty'URIType'isnotwritableorhasaninvalidsettermethod.Doestheparametertypeofthesettermatchthereturntypeofthegetter? atorg.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.applyPropertyValues(AbstractAutowireCapablebeanfactory.java:1279) atorg.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.populateBean(AbstractAutowireCapablebeanfactory.java:1010) atorg.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.doCreateBean(AbstractAutowireCapablebeanfactory.java:472) atorg.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory$1.run(AbstractAutowireCapablebeanfactory.java:409) atjava.security.AccessController.doPrivileged(NativeMethod) atorg.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.createBean(AbstractAutowireCapablebeanfactory.java:380) atorg.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:219) ...44more Causedby:org.springframework.beans.NotWritablePropertyException:Invalidproperty'URIType'ofbeanclass[com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]:Beanproperty'URIType'isnotwritableorhasaninvalidsettermethod.Doestheparametertypeofthesettermatchthereturntypeofthegetter? atorg.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:801)
这些错误
原来是我用的jdk版本太高,jdk8,dubbo默认用的spring版本比较旧,冲突导致,作如下修改即可
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>-->
重新编译dubbo放tomcat运行,成功启动!