Page 1 of 1

Problem in Extending an entity

Posted: Mon Feb 25, 2013 12:16 pm
by EL AMMARIA
I'm working on the tutorial, in "Extending Customer For Heat Clinic Tutorial", i followed all the steps but i still have the problem :

[artifact:mvn] GRAVE: Servlet.service() for servlet mycompany threw exception
[artifact:mvn] java.lang.ClassCastException: org.broadleafcommerce.profile.core.domain.CustomerImpl cannot be cast to com.mycompany.profile.core.domain.HCCustomer
[artifact:mvn] at com.mycompany.checkout.service.workflow.RecordHeatRangeActivity.execute(RecordHeatRangeActivity.java:43)
[artifact:mvn] at org.broadleafcommerce.core.workflow.SequenceProcessor.doActivities(SequenceProcessor.java:62)
[artifact:mvn] at org.broadleafcommerce.core.checkout.service.CheckoutServiceImpl.performCheckout(CheckoutServiceImpl.java:75)
[artifact:mvn] at org.broadleafcommerce.core.web.controller.checkout.BroadleafCheckoutController.completeSecureCreditCardCheckout(BroadleafCheckoutController.java:416)
[artifact:mvn] at com.mycompany.controller.checkout.CheckoutController.completeSecureCreditCardCheckout(CheckoutController.java:123)
[artifact:mvn] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[artifact:mvn] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

my be there are a missed step !!??
Thanks for help.

Re: Problem in Extending an entity

Posted: Mon Feb 25, 2013 1:18 pm
by phillipuniverse
Looks like you missed the "Set the default Entity Configuration" step where you modify applicationContext-entity.xml. Also, since this occurs in core, you will have to either do a full rebuild of the project or build core and then build site in order to get these changes.

Re: Problem in Extending an entity

Posted: Mon Feb 25, 2013 4:01 pm
by EL AMMARIA
i did also this step, i added in the file core/src/main/resources/applicationContext-entity.xml :
<bean id="org.broadleafcommerce.profile.core.domain.Customer"
class="com.mycompany.profile.core.domain.HCCustomerImpl"
scope="prototype"/>
I made a full rebuild, and i still have the problem, it's strange :-(.

Re: Problem in Extending an entity

Posted: Mon Feb 25, 2013 5:01 pm
by phillipuniverse
Perhaps you are logging with a previously-created customer? If so, you would have an entry in the BLC_CUSTOMER table but not a corresponding entry in the HC_CUSTOMER table. Try registering a new Customer. What happens in that scenario in relation to the database?

Re: Problem in Extending an entity

Posted: Tue Feb 26, 2013 7:12 am
by EL AMMARIA
I think is a cash problem, because in the logs and just before my exception stack trace i have :

http-8443-1 WARN strategy.AbstractReadWriteEhcacheAccessStrategy - Cache blStandardElements Key org.broadleafcommerce.profile.core.domain.CustomerImpl.customerAttributes#102 Lockable : null
A soft-locked cache entry was expired by the underlying Ehcache. If this happens regularly you should consider increasing the cache timeouts and/or capacity limits
http-8443-1 ERROR workflow.DefaultErrorHandler - An error occurred during the workflow

in the log we can see that the application use org.broadleafcommerce.profile.core.domain.CustomerImpl.
do you see anything that can help me plz.
thanks .

Re: Problem in Extending an entity

Posted: Tue Feb 26, 2013 10:46 pm
by phillipuniverse
Possible, but if you have restarted the application then the Hibernate cache is cleared. What happens with the scenario that I presented above?

Re: Problem in Extending an entity

Posted: Wed Feb 27, 2013 4:51 am
by EL AMMARIA
in each test i use a new customer, and i still have the same problem.