A component named 'XXX' is already defined in this module in JBoss 7.1.1 A component named 'XXX' is already defined in this module in JBoss 7.1.1 spring spring

A component named 'XXX' is already defined in this module in JBoss 7.1.1


I had a bean annotated with @Singleton and @Stateless that triggered this error. My code was of course wrong but the message and posts like this lead me down the wrong path for a while.


I know the answer to this one. Spent weeks with JBoss Support on it due to my stubborness. They plan on providing fix or at least better messaging with EAP 6.2.x release.

The problem arises with the EJB Annotation preprocessors - which take your war, and the libs compiled into it and scans them for EJB annotations. Some Jar files can have an entry in the Manifest for "Classpath: ." (or whatever but with '.' as one of the entries). This causes the annotation preprocessor to idiotically process all the jar files in the web-inf lib again. Finally it will get around to a jar file with an EJB annotation in it that it has already seen, because it was already processed earlier - this causes it to complain with "A component Named xxx is already defined".

So the most frustrating part here is that it's probably some old jar file that you don't even care about that has this unnecessary Classpath manifest entry in it - and causes JBoss to recurse on itself.


I had the same problem but for me none of the suggested solutions helped.I noticed that the EJB JAR was present twice (newest version and older version) in the WEB.WAR.

This was because the maven clean operation on the parent project in eclipse didn't cascade to the child projects.I fixed it by doing a simple "mvn clean" on the child project.