Page 1 of 1

issue with URL mapping internal to broadleaf

Posted: Wed Feb 15, 2012 6:34 pm
by sai
I am trying to intigrate my project in Broadleaf 1.5.2 version, used archetype to set up initial project. As soon as I add
<mvc:annotation-driven/> tag I am seeing following exception

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0': Initialization of bean failed; nested exception is java.lang.IllegalStateException: Cannot map handler 'mycompanyCheckoutController' to URL path [/checkout/checkout.htm]: There is already handler of type [class org.broadleafcommerce.core.web.controller.checkout.CheckoutController] mapped.

Seems like the same URL mapping is mentioned in two different objects causing the handler not being able to map the URL. In this case
'/checkout/checkout.htm' might be mentioned in CheckoutController & in 'mycompanyCheckoutController'

My project is not AOP project and I am trying to see if I can get both of them work together or integrate them easily. But the above issue seems something internal in Broadleaf.

Also could you please advise on the version which you recommend for my POC with broadleaf.

Any advise is much appreciated.

Re: issue with URL mapping internal to broadleaf

Posted: Wed Feb 15, 2012 6:46 pm
by jefffischer
Try removing the line (or adding package exclusions):

Code: Select all

<context:component-scan base-package="org.broadleafcommerce.core.web"/>


from your applicationContext-servlet.xml. I imagine when you turn on annotation scanning, you're picking up the checkout controller from Broadleaf.

Also, we'll be coming out with a 1.5.3 soon, which should be a painless upgrade from 1.5.2. However, we've also got 1.6 milestone releases that are stable and represent a soon upcoming release. 1.6 has a decent amount of package refactoring, so you will likely save yourself some future pain when migrating from your POC to your real application if you start with the latest 1.6 M1 release. These are available in our releases repository:

http://www.broadleafcommerce.org/nexus/ ... /releases/

Re: issue with URL mapping internal to broadleaf

Posted: Wed Feb 15, 2012 10:45 pm
by sai
Thank you for quick response Jeff.

I tried to remove in 1.5.2 version of broadleaf, but I am getting bean creation exceptions. So I removed the mvc:annotation-driven tag. I thought I will give a try with just adding one new controller. Created a link in defaultCatalog page. My intention is to show a page which I add upon this action to show in the same window. I used the store/myaction to call the controller. declared the bean. I added a context:component scan to identify the controller

The new controller has logic to just return a veiw name.

The below error is fishy. I am not sure what I am doing wrong here. I see a class file created in target. But it is complaining of not finding it.

[artifact:mvn] [ERROR] 22:20:26 DispatcherServlet - Context initialization failed
[artifact:mvn] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blStaticAssetViewController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blStaticAssetStorageService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blStaticAssetService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blStaticAssetDao': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.mycompany.ecommerce.web.controller.myController] for bean with name myController' defined in ServletContext resource [/WEB-INF/applicationContext-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.mycompany.ecommerce.web.controller.myController

I tried with 1.6 M and 1.6M-4, I am getting below exception when I run the Ant --> Jetty:demo .

[artifact:mvn] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.broadleafcommerce.core.web.order.security.MergeCartProcessorImpl' to required type 'org.springframework.security.web.authentication.AuthenticationSuccessHandler' for property 'authenticationSuccessHandler'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.broadleafcommerce.core.web.order.security.MergeCartProcessorImpl] to required type [org.springframework.security.web.authentication.AuthenticationSuccessHandler] for property 'authenticationSuccessHandler': no matching editors or conversion strategy found

Thank you very much for the support. I appreciate any help on this.

Re: issue with URL mapping internal to broadleaf

Posted: Tue Feb 21, 2012 11:31 am
by jefffischer
You probably need to have these lines at the end of your applicationContext-servlet.xml:

Code: Select all

<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/>
<bean class="org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter"/>
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>

<mvc:default-servlet-handler/>


If you run into problem using 1.6 - you'll want to compare you application config against the latest archetype source. You can find it here:

https://github.com/BroadleafCommerce/Br ... Archetypes