Page 1 of 1

Problem Adding Products After ETL Import

Posted: Sun Apr 21, 2013 6:01 am
by fibernut
Hello again,
I have an unusual problem, I have imported my catalog directly into the MySQL database but when I try to add a product in the admin console it fails. The following is the error message I get. Another problem I encounter whether it is related or not I don't know, is that I cannot add products to the homepage featured section. I can add them in the admin console to the Home catagory but they never display. No error messages are displayed, I shall try adding them to the Home catagory via MySQL directly and see if that has any effect.

New Product Error Log:

Code: Select all

[ WARN] 11:51:29 JDBCExceptionReporter - SQL Error: 1062, SQLState: 23000
[ERROR] 11:51:29 JDBCExceptionReporter - Duplicate entry '1000' for key 'PRIMARY'
[ERROR] 11:51:29 ProductCustomPersistenceHandler - Unable to add entity for org.broadleafcommerce.core.catalog.domain.ProductImpl
javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
   at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1389)
   at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1317)
   at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1323)
   at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:965)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365)
   at $Proxy83.flush(Unknown Source)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
   at $Proxy83.flush(Unknown Source)
   at org.broadleafcommerce.openadmin.server.dao.DynamicEntityDaoImpl.merge(DynamicEntityDaoImpl.java:122)
   at org.broadleafcommerce.admin.server.service.handler.ProductCustomPersistenceHandler.add(ProductCustomPersistenceHandler.java:73)
   at org.broadleafcommerce.openadmin.server.service.persistence.PersistenceManagerImpl.add(PersistenceManagerImpl.java:271)
   at org.broadleafcommerce.openadmin.server.service.DynamicEntityRemoteService.add(DynamicEntityRemoteService.java:138)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy129.add(Unknown Source)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.gwtwidgets.server.spring.GWTRPCServiceExporter.invokeMethodOnService(GWTRPCServiceExporter.java:245)
   at org.gwtwidgets.server.spring.GWTRPCServiceExporter.processCall(GWTRPCServiceExporter.java:410)
   at org.broadleafcommerce.openadmin.security.CompatibleGWTSecuredRPCServiceExporter.processCall(CompatibleGWTSecuredRPCServiceExporter.java:105)
   at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
   at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
   at org.gwtwidgets.server.spring.GWTRPCServiceExporter.handleRequest(GWTRPCServiceExporter.java:478)
   at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
   at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.broadleafcommerce.openadmin.security.AdminSandBoxFilter.doFilterInternal(AdminSandBoxFilter.java:70)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
   at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
   at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
   at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:108)
   at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
   at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:144)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
   at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
   at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
   at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:147)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.broadleafcommerce.common.web.util.PrecompressedArtifactFilter.doFilter(PrecompressedArtifactFilter.java:85)
   at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
   at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Thread.java:662)
Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
   at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
   at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
   at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
   at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:962)
   ... 108 more
Caused by: java.sql.BatchUpdateException: Duplicate entry '1000' for key 'PRIMARY'
   at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2054)
   at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1467)
   at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
   ... 114 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1000' for key 'PRIMARY'
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
   at com.mysql.jdbc.Util.getInstance(Util.java:386)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1040)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719)
   at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
   at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2450)
   at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2006)
   ... 117 more
[ WARN] 11:51:29 AbstractReadWriteEhcacheAccessStrategy - Cache blStandardElements Key org.broadleafcommerce.core.catalog.domain.SkuImpl.excludedFulfillmentOptions#10000 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
[ WARN] 11:51:29 AbstractReadWriteEhcacheAccessStrategy - Cache blStandardElements Key org.broadleafcommerce.core.catalog.domain.SkuImpl.fees#10000 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
[ WARN] 11:51:29 AbstractReadWriteEhcacheAccessStrategy - Cache blStandardElements Key org.broadleafcommerce.core.catalog.domain.SkuImpl.fulfillmentFlatRates#10000 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
[ WARN] 11:51:29 AbstractReadWriteEhcacheAccessStrategy - Cache blStandardElements Key org.broadleafcommerce.core.catalog.domain.SkuImpl.productOptionValues#10000 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
[ WARN] 11:51:29 AbstractReadWriteEhcacheAccessStrategy - Cache blStandardElements Key org.broadleafcommerce.core.catalog.domain.SkuImpl.skuAttributes#10000 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
[ WARN] 11:51:29 AbstractReadWriteEhcacheAccessStrategy - Cache blStandardElements Key org.broadleafcommerce.core.catalog.domain.SkuImpl.skuMedia#10000 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
[ WARN] 11:51:29 CompatibleGWTSecuredRPCServiceExporter - org.broadleafcommerce.common.exception.ServiceException: Unable to add entity for org.broadleafcommerce.core.catalog.domain.ProductImpl
[ WARN] 11:51:29 RuntimeEnvironmentPropertiesConfigurer - Unable to determine runtime environment, using default environment 'development'

Re: Problem Adding Products After ETL Import

Posted: Mon Apr 22, 2013 10:29 am
by phillipuniverse
Look at the SEQUENCE_GENERATOR table for the 'ProductImpl' segment value (SELECT ID_VAL FROM SEQUENCE_GENERATOR WHERE ID_NAME='ProductImpl') and also the largest primary key in the BLC_PRODUCT table (SELECT MAX(PRODUCT_ID) FROM BLC_PRODUCT). New primary keys come from the SEQUENCE_GENERATOR table and it looks like you already have a product with the first primary key obtained from SEQUENCE_GENERATOR.

For the list of products in the homepage featured section, I think that is currently configured to just print the first 2 products in that list? Check home.html to see how these are being displayed. Also, if you are adding products to be viewed on a normal category page (like 'Hot Sauces' or 'Merchandise') then these will only show up after the Solr index is rebuilt (which is defaulted to every 15 minutes; you can change this in site/applicationContext.xml).

Re: Problem Adding Products After ETL Import

Posted: Mon Apr 22, 2013 10:40 am
by fibernut
The is a difference of 6000 between the SEQUENCE_GENERATOR table and the BLC_PRODUCT Table. I guess I should change the last entry in the SEQUENCE_GENERATOR table to a number beyond that of the BLC_PRODUCT Table.

The home.html page code is unchanged:

Code: Select all

<body>
    <div id="notification_bar"></div>
    <header th:substituteby="layout/partials/header" />
   
    <div id="content" class="width_setter group" role="main">
   
        <nav th:substituteby="layout/partials/nav" />
           
        <blc:content contentType="Homepage Banner Ad" />       
        <div id="banners">
            <a th:href="@{${contentItem['targetUrl']}}"><img th:src="@{${contentItem['imageUrl']}}" alt="Buy One Get One" /></a>       
        </div>
       
        <blc:content contentType="Homepage Middle Promo Snippet" />
       
        <a th:href="@{/register}" style="text-decoration:none">
            <div id="home_feature" th:utext="${contentItem['htmlContent']}"></div>
        </a>

       
        <blc:content contentType="Homepage Featured Products Title" />   
        <div class="title_bar" th:text="${contentItem['messageText']}"></div>
       
        <ul id="products" class="group">
            <li th:each="product : ${products}" th:object="${product}" th:include="catalog/partials/productListItem" class="product_container"></li>
        </ul>
    </div>
   
    <footer th:substituteby="layout/partials/footer" />
   
</body>


When I add a product to the home catagory in the Admin console it is not displayed on the home page. I have also set the DEFAULT_CATAGORY_ID in BLC_PRODUCT to 2001 which is the Home catagory_id.

I do not have any idea why these are not being displayed>