2 huang477706996 huang477706996 于 2015.06.06 13:10 提问

maven 项目中修改项目的包名后重新启动报错

原来项目运行时正常的,后来把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]

3个回答

jiuqiyuliang
jiuqiyuliang   2015.06.06 14:31

ApplicationContext.xml这个配置中定义了一个picturesService的bean,class与原来不对应了,com.fh.service.information.pictures.PicturesService这个应该是错的
需要改成com.fh.controller.information.PictureController

huang477706996
huang477706996   2015.06.07 10:31

找了半天 终于找到原因了 原来是maven生成的class文件中还存在原来的class文件,只要吧webapp下的web-inf下面的class文件去掉就好了

srd123
srd123   2016.08.13 17:28

不可能每次生成class文件后都要手动删除吧,有没有好的解决办法

Csdn user default icon
上传中...
上传图片
插入图片