Broadleaf Commerce 3.1.0 is Giving Error

233 views Asked by At

We are using BroadleafCommerce 3.1.0. Prior to this , We are using 3.0.13. Everything was working fine in 3.0.13. We did all the required changes as per the Migration Notes present in BLC WebSite. After doing all, we can able to compile the WorkSpace. Deployment also successfull. While invoking MyCompany,And Admin we are getting following error :

   ==============================================>MYCOMPANY
            java.lang.NullPointerException
                    at org.broadleafcommerce.common.web.BroadleafRequestCustomerResolverImpl.setCustomer(BroadleafRequestCustomerResolverImpl.java:62)
                    at org.broadleafcommerce.profile.web.core.CustomerState.setCustomer(CustomerState.java:52)
                    at org.broadleafcommerce.profile.web.core.security.CustomerStateRequestProcessor.process(CustomerStateRequestProcessor.java:134)
                    at org.broadleafcommerce.profile.web.core.security.CustomerStateFilter.doFilter(CustomerStateFilter.java:55)
                    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
           .......

        ======================================>ADMIN

         Error while inserting fetched product id:12357968
        org.springframework.dao.DataIntegrityViolationException: Cannot add or update a child row: a foreign key constraint fails (`broadleaf`.`blc_product`, CONSTRAINT `FK5B95B7C96D386535` FOREIGN KEY (`DEFAULT_SKU_ID`) REFERENCES `blc_sku` (`SKU_ID`)); SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`broadleaf`.`blc_product`, CONSTRAINT `FK5B95B7C96D386535` FOREIGN KEY (`DEFAULT_SKU_ID`) REFERENCES `blc_sku` (`SKU_ID`))
            at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:643)
            at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:105)
            at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:517)
            at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:755)
            at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724)
            at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:475)
            at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:270)
            at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
            at com.sun.proxy.$Proxy161.saveSku(Unknown Source)

        Caused by: org.hibernate.exception.ConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`broadleaf`.`blc_product`, CONSTRAINT `FK5B95B7C96D386535` FOREIGN KEY (`DEFAULT_SKU_ID`) REFERENCES `blc_sku` (`SKU_ID`))
            at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:74)
            at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
            at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
            at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
            at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129)
            at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
            at com.sun.proxy.$Proxy447.executeUpdate(Unknown Source)
            at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:56)
            at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3028)
            at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3469)
            at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)
            at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
            at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354)
            at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:275)
            at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326)
            at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
            at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1213)
            at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:402)
            at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
            at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
            at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:75)
            at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:513)
            ... 109 more
1

There are 1 answers

0
polster On

For the admin issue, drop the constraint from the blc_product table for default_sku_id. I verified that in 3.1, this constraint is no longer created as part of the install.

For the site issue, double check your web.xml and applicationContext.xml against a new 3.1 demo install to see if you can spot any differences. If you can recreate with a clean 3.1 demo install then open an issue in GitHub. Otherwise, you might try adding breakpoints in your code and in similar spots in a clean 3.1 demo install to see if you can determine the difference.

Edit: The site issue is being tracked separately here: Getting error while Giving Request to MyCompany in Broadleaf Commerce

Brian, Disclaimer : I work at Broadleaf Commerce