1、安裝好tomcat之後,
下載下傳并且編譯最新的dubbo-admin 如圖:
<a href="https://s2.51cto.com/wyfs02/M01/92/C3/wKioL1kC0JWQ4QZxAAB-qK3tSjQ574.png-wh_500x0-wm_3-wmp_4-s_1706004023.png" target="_blank"></a>
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位址
如果出現:
<code> </code><code>INFO context.InheritableListableBeanFactory - Destroying singletons in com.alibaba.citrus.springext.support.context.InheritableListableBeanFactory</code><code>@55af05cd</code><code>: defining beans [org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,com.alibaba.citrus.service.configuration.support.PropertyPlaceholderConfigurer#</code><code>0</code><code>,templateService,mappingRuleService,dataResolverService,exceptionPipeline,resourceLoadingService,messageSource,uriBrokerService,restfulRewrite,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#</code><code>0</code><code>,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#</code><code>0</code><code>,uploadService,pullService,formService,module.screen.Error404,module.screen.ErrorOther,moduleLoaderService,messageResourceService,com.alibaba.citrus.webx.context.WebxComponentsLoader$WebxComponentsCreator]; root of factory hierarchy</code>
<code>ERROR context.ContextLoader - Context initialization failed</code>
<code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name </code><code>'uriBrokerService'</code><code>: Cannot create inner bean </code><code>'(inner bean)'</code> <code>of type [com.alibaba.citrus.service.uribroker.impl.URIBrokerServiceImpl$URIBrokerInfo] </code><code>while</code> <code>setting bean property </code><code>'brokers'</code> <code>with key [</code><code>0</code><code>]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name </code><code>'(inner bean)#25'</code><code>: Cannot create inner bean </code><code>'server'</code> <code>of type [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker] </code><code>while</code> <code>setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name </code><code>'server'</code><code>: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property </code><code>'URIType'</code> <code>of bean </code><code>class</code> <code>[com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]: Bean property </code><code>'URIType'</code> <code>is not writable or has an invalid setter method. Does the parameter type of the setter match the </code><code>return</code> <code>type of the getter?</code>
<code> </code><code>at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:</code><code>230</code><code>)</code>
<code> </code><code>at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:</code><code>122</code><code>)</code>
<code> </code><code>at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:</code><code>287</code><code>)</code>
<code> </code><code>at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:</code><code>126</code><code>)</code>
<code> </code><code>at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:</code><code>1245</code><code>)</code>
<code> </code><code>at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:</code><code>1010</code><code>)</code>
<code>142</code><code>)</code>
<code> </code><code>at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:</code><code>617</code><code>)</code>
<code> </code><code>at java.lang.Thread.run(Thread.java:</code><code>745</code><code>)</code>
<code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name </code><code>'(inner bean)#25'</code><code>: Cannot create inner bean </code><code>'server'</code> <code>of type [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker] </code><code>while</code> <code>setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name </code><code>'server'</code><code>: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property </code><code>'URIType'</code> <code>of bean </code><code>class</code> <code>[com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]: Bean property </code><code>'URIType'</code> <code>is not writable or has an invalid setter method. Does the parameter type of the setter match the </code><code>return</code> <code>type of the getter?</code>
<code> </code><code>at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:</code><code>117</code><code>)</code>
<code> </code><code>at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:</code><code>479</code><code>)</code>
<code> </code><code>at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:</code><code>219</code><code>)</code>
<code> </code><code>... </code><code>34</code> <code>more</code>
<code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name </code><code>'server'</code><code>: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property </code><code>'URIType'</code> <code>of bean </code><code>class</code> <code>[com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]: Bean property </code><code>'URIType'</code> <code>is not writable or has an invalid setter method. Does the parameter type of the setter match the </code><code>return</code> <code>type of the getter?</code>
<code> </code><code>at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:</code><code>1279</code><code>)</code>
<code> </code><code>at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:</code><code>472</code><code>)</code>
<code> </code><code>at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$</code><code>1</code><code>.run(AbstractAutowireCapableBeanFactory.java:</code><code>409</code><code>)</code>
<code> </code><code>at java.security.AccessController.doPrivileged(Native Method)</code>
<code> </code><code>at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:</code><code>380</code><code>)</code>
<code> </code><code>... </code><code>44</code> <code>more</code>
<code>Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property </code><code>'URIType'</code> <code>of bean </code><code>class</code> <code>[com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]: Bean property </code><code>'URIType'</code> <code>is not writable or has an invalid setter method. Does the parameter type of the setter match the </code><code>return</code> <code>type of the getter?</code>
<code> </code><code>at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:</code><code>801</code><code>)</code>
這些錯誤
1、webx的依賴改為3.1.6版;
<code><dependency></code>
<code> </code><code><groupId>com.alibaba.citrus</groupId></code>
<code> </code><code><artifactId>citrus-webx-all</artifactId></code>
<code> </code><code><version></code><code>3.1</code><code>.</code><code>6</code><code></version></code>
<code> </code><code></dependency></code>
2、添加velocity的依賴,我用了1.7;
<code> </code><code><dependency></code>
<code> </code><code><groupId>org.apache.velocity</groupId></code>
<code> </code><code><artifactId>velocity</artifactId></code>
<code> </code><code><version></code><code>1.7</code><code></version></code>
3、對依賴項dubbo添加exclusion,避免引入舊spring
<code> </code><code><groupId>com.alibaba</groupId></code>
<code> </code><code><artifactId>dubbo</artifactId></code>
<code> </code><code><version>${project.parent.version}</version></code>
<code> </code><code><exclusions></code>
<code> </code><code><exclusion></code>
<code> </code><code><groupId>org.springframework</groupId></code>
<code> </code><code><artifactId>spring</artifactId></code>
<code> </code><code></exclusion></code>
<code> </code><code></exclusions></code>
4、webx已有spring 3以上的依賴,是以注釋掉dubbo-admin裡面的spring依賴
<code> </code><code><!--<dependency>--></code>
<code> </code><code><!--<groupId>org.springframework</groupId>--></code>
<code> </code><code><!--<artifactId>spring</artifactId>--></code>
<code> </code><code><!--</dependency>--></code>
重新編譯dubbo放tomcat運作,成功啟動!
本文轉自yunlielai51CTO部落格,原文連結:http://blog.51cto.com/4925054/1920385,如需轉載請自行聯系原作者