Annotation-specified bean name for bean conflicts with existing, non-compatible bean definition

In my Java Web application, I have moved one of my bean classes to another package. After this change, the deployment of the app to a J2EE container fails. The exception I get is:
ERROR: org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring/servlet-context.xml]; nested exception is java.lang.IllegalStateException:
Annotation-specified bean name 'apexTestService' for bean class [] conflicts with existing,
non-compatible bean definition of same name and class []

I am using Maven to manage my project.
graham on 01-02-2013 13:29
The reason of this problem is that the previous compiled version of my class (before refactoring) got cached in the target directory of my Maven project. Executing:
mvn clean

solved the issue.
graham on 01-02-2013 13:31

Post an answer

Do you have a solution to this problem, or want to comment on it? Other users will appreciate your help!
Your answer or comment:
Show formatting hints
HTML is disallowed, but in your text you can use the following markup
  • [code][/code] for a block of code
  • [tt][/tt] for inline code
  • [link]link href|link anchor[/link] for links
  • [b][/b] for bold text
+ Ask a question
If you have a technical question related to programming and computers, ask it here. Other users will help you solve it!
Unanswered questions
Share your knowledge by helping others solve their problems