原来项目运行时正常的,后来把com.fh.controller.information.picture.PictureController
和com.fh.service.information.picture.PictureService修改为com.fh.controller.information.PictureController
和com.fh.service.information.PictureService后出错
启动项目报错如下错误
信息: Initializing Spring root WebApplicationContext
2015-06-06 12:04:32 -0 [localhost-startStop-1] INFO - Root WebApplicationContext: initialization started
2015-06-06 12:04:32 -184 [localhost-startStop-1] INFO - Refreshing Root WebApplicationContext: startup date [Sat Jun 06 12:04:32 CST 2015]; root of context hierarchy
2015-06-06 12:04:33 -248 [localhost-startStop-1] INFO - Loading XML bean definitions from class path resource [spring/ApplicationContext.xml]
2015-06-06 12:04:33 -483 [localhost-startStop-1] ERROR - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [spring/ApplicationContext.xml]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'picturesService' for bean class [com.fh.service.information.PicturesService] conflicts with existing, non-compatible bean definition of same name and class [com.fh.service.information.pictures.PicturesService]
找了半天终于找到原因了原来是maven生成的class文件中还存在原来的class文件,只要吧webapp下的web-inf下面的class文件去掉就好了
ApplicationContext.xml这个配置中定义了一个picturesService的bean,class与原来不对应了,com.fh.service.information.pictures.PicturesService这个应该是错的
需要改成com.fh.controller.information.PictureController
不可能每次生成class文件后都要手动删除吧,有没有好的解决办法
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。