分布式网上商城项目- BeanDefinitionStoreException

Posted thyhome

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了分布式网上商城项目- BeanDefinitionStoreException相关的知识,希望对你有一定的参考价值。

 

BeanDefinitionStoreException:

 

 1 严重: StandardWrapper.Throwable
 2 
 3 org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [spring/springmvc.xml]; nested exception is java.lang.IllegalStateException: Duplicate spring bean id userRegisterController
 4 
 5          at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)
 6 
 7          at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
 8 
 9          at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
10 
11          at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
12 
13          at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
14 
15          at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
16 
17          at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
18 
19          at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
20 
21          at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
22 
23          at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:609)
24 
25          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:510)
26 
27          at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
28 
29          at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
30 
31          at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
32 
33          at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
34 
35          at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
36 
37          at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
38 
39          at javax.servlet.GenericServlet.init(GenericServlet.java:160)
40 
41          at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
42 
43          at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
44 
45          at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
46 
47          at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
48 
49          at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
50 
51          at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
52 
53          at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
54 
55          at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
56 
57          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
58 
59          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
60 
61          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
62 
63          at java.base/java.lang.Thread.run(Thread.java:844)
64 
65 Caused by: java.lang.IllegalStateException: Duplicate spring bean id userRegisterController
66 
67          at com.alibaba.dubbo.config.spring.schema.DubboBeanDefinitionParser.parse(DubboBeanDefinitionParser.java:106)
68 
69          at com.alibaba.dubbo.config.spring.schema.DubboBeanDefinitionParser.parse(DubboBeanDefinitionParser.java:77)
70 
71          at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)
72 
73          at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1411)
74 
75          at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1401)
76 
77          at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:168)
78 
79          at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:138)
80 
81          at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:94)
82 
83          at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508)
84 
85          at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392)
86 
87          ... 29 more

 

可以知道是userRegisterController在springmvc中注册了两次,检查发现扫描和注解都没问题。查看dubbo的时候发现远程连接的应该是userService修改:BeanDefinitionStoreException错误。

1 <dubbo:reference interface="cn.thyonline.taotao.sso.service.UserRegisterService" id="userRegisterService" timeout="300000"/>

 

以上是关于分布式网上商城项目- BeanDefinitionStoreException的主要内容,如果未能解决你的问题,请参考以下文章

分布式网上商城项目-solr搜索功能错误

Xbin-Store(分布式商城)项目所用Linux服务系列 FastDFS安装

分布式网上商城项目-图片上传及删除功能错误

分布式网上商城项目-dubbo搭建与初次使用错误

谷粒商城-分布式基础项目环境搭建

谷粒商城-分布式基础项目环境搭建