Broadleaf Commerce 3.1.0给出了错误

时间:2014-11-25 11:41:08

标签: spring hibernate spring-mvc spring-transactions broadleaf-commerce

我们正在使用BroadleafCommerce 3.1.0。在此之前,我们正在使用3.0.13。一切都在3.0.13正常工作。我们根据BLC WebSite中的迁移说明进行了所有必需的更改。完成后,我们可以编译WorkSpace。部署也成功。在调用MyCompany和And Admin时,我们遇到以下错误:

   ==============================================>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 个答案:

答案 0 :(得分:0)

对于admin问题,请从blc_product表中删除default_sku_id的约束。我在3.1中验证了此约束不再作为安装的一部分创建。

对于网站问题,请针对新的3.1演示安装仔细检查您的web.xml和applicationContext.xml,看看您是否能发现任何差异。如果您可以使用干净的3.1演示安装重新创建,那么在GitHub中打开一个问题。否则,您可以尝试在代码中以及在干净的3.1演示安装中的类似位置添加断点,以查看是否可以确定差异。

修改:此处单独跟踪网站问题:Getting error while Giving Request to MyCompany in Broadleaf Commerce

布莱恩 免责声明:我在Broadleaf Commerce工作