0

I noticed a weird behavior in my Spring MVC application:

  • My request mappings are all unique and I am positive there are no ambiguous mappings. I can run my app fine in STS's embedded tomcat.
  • However when I drop a jar in a standalone tomcat, I systematically get an ambiguous mapping error as show below.

Stacktrace:

IllegalStateException: Ambiguous mapping found. Cannot map 'preferenceController' bean method 
public java.lang.String com.bignibou.controller.PreferenceController.modifyEmail(com.bignibou.controller.helpers.EmailInfo,org.springframework.validation.BindingResult,org.springframework.ui.Model)
to {[/preferences/email],methods=[POST],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}: There is already 'preferencesController' bean method
public java.lang.String com.bignibou.controller.PreferencesController.modifyEmail(com.bignibou.controller.helpers.EmailInfo,org.springframework.validation.BindingResult,org.springframework.ui.Model) mapped.

Has anyone seen this problem before? FYI, I run tomcat 7.0.35 and spring 3.2.

balteo
  • 23,602
  • 63
  • 219
  • 412

1 Answers1

1

It looks like you have two different classes: PreferenceController and PreferencesController with the same method. Just delete one of the modifyEmail methods and see if it works.

Dave L.
  • 9,595
  • 7
  • 43
  • 69
  • Well spotted David! I actually renamed that class from PreferencesController to PreferenceController a while ago. I've mvn cleaned the app and the old class is still somewhere. Very odd... – balteo Mar 22 '13 at 17:09
  • Also just to be sure, you can delete everything in Tomcat's temporary directories: `rm -rf $CATALINA_HOME/work/*` – Dave L. Mar 22 '13 at 17:13