java.lang.IllegalStateException: Cannot map handler [controller] to URL path : There is already handler

I am using Spring 3.0 for my new application…I am not very familiar with annotation but learning them they are cool.  Today I faced “Cannot Map Handler [XXX] to URL Path” error, while running my page.

Later debug I found that I duplicated the Controller definition stuff inside XXX-Servlet.xml as below.

<context:component-scan base-package="org.me.spring.web" />

and

<bean  class="org.me.spring.web.SampleController" >

The first line will auto-discover and register a SampleController for you. By explicitly declaring another one, you get a duplicate, and the url-mapping will clash.

You need to either remove the <context:component-scan>, or remove the explicit bean definitions for the controller and the DAO. If you do the latter, then you’ll need to use autowiring to inject their dependencies.

This entry was posted in Java, Spring and tagged , . Bookmark the permalink.

One Response to java.lang.IllegalStateException: Cannot map handler [controller] to URL path : There is already handler

  1. Ervin says:

    I’m trying to imorpt the OVF to Workstation 8.03 but I get the following errors:The imorpt failed because C:\AppFactory.ovf did not pass OVF specification conformance or virtual hardware compliance checks.Click Retry to relax OVF specification and virtual hardware compliance checks and try the imorpt again, or click Cancel to cancel the imorpt. If you retry the imorpt, you might not be able to use the virtual machine in VMware Workstation.When I click retry I get:Line 117: Unsupported element Property’.Has anybody sucessfully imorpted directly into Workstation 8, or seen this issue?Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *