Page 1 of 1

Not able to update the product in admin console

Posted: Thu Jan 16, 2014 12:15 pm
by henry
Hi i am trying to save the product and their sku along with product in admin controller it working fine. but when i am trying to update the product from the admin console its not able update when i click on save button for updating the detail blank page is coming here is my error

Code: Select all

javax.persistence.EntityNotFoundException: Unable to find org.broadleafcommerce.core.catalog.domain.CategoryImpl with id 10156
   at org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound(Ejb3Configuration.java:155)
   at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:210)
   at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:260)
   at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:148)
   at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1078)
   at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1005)
   at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:651)
   at org.hibernate.type.EntityType.resolve(EntityType.java:471)
   at org.hibernate.type.EntityType.replace(EntityType.java:328)
   at org.hibernate.type.AbstractType.replace(AbstractType.java:178)
   at org.hibernate.type.TypeHelper.replace(TypeHelper.java:211)
   at org.hibernate.event.internal.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:409)
   at org.hibernate.event.internal.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:214)
   at org.hibernate.event.internal.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:282)
   at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:151)
   at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:76)
   at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:903)
   at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:887)
   at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:891)
   at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:889)
   at sun.reflect.GeneratedMethodAccessor196.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:366)
   at com.sun.proxy.$Proxy97.merge(Unknown Source)
   at sun.reflect.GeneratedMethodAccessor196.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:241)
   at com.sun.proxy.$Proxy97.merge(Unknown Source)
   at org.broadleafcommerce.core.catalog.dao.ProductDaoImpl.save(ProductDaoImpl.java:74)
   at org.broadleafcommerce.core.catalog.service.CatalogServiceImpl.saveProduct(CatalogServiceImpl.java:102)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
   at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
   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.$Proxy134.saveProduct(Unknown Source)
   at com.admin.api.service.getproducts.GetProductsServiceImpl.updateProductsToDB(GetProductsServiceImpl.java:98)
   at com.admin.api.service.getproducts.GetProductsServiceImpl.getAvailableProducts(GetProductsServiceImpl.java:81)
   at com.admin.util.controller.CustomAdminController.getProducts(CustomAdminController.java:38)
   at com.admin.util.controller.CustomAdminController$$FastClassByCGLIB$$2af94fc8.invoke(<generated>)
   at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
   at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
   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.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
   at com.admin.util.controller.CustomAdminController$$EnhancerByCGLIB$$e17265f9.getProducts(<generated>)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
   at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
   at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
   at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
   at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
   at org.broadleafcommerce.openadmin.web.compatibility.JSCompatibilityRequestFilter.doFilterInternal(JSCompatibilityRequestFilter.java:37)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.broadleafcommerce.openadmin.security.AdminSandBoxFilter.doFilterInternal(AdminSandBoxFilter.java:70)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.broadleafcommerce.common.web.util.PrecompressedArtifactFilter.doFilter(PrecompressedArtifactFilter.java:85)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   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:166)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   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.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:91)
   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.broadleafcommerce.common.security.handler.CsrfFilter.doFilter(CsrfFilter.java:82)
   at org.broadleafcommerce.openadmin.web.filter.AdminCsrfFilter.doFilter(AdminCsrfFilter.java:38)
   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$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
   at org.broadleafcommerce.openadmin.web.filter.BroadleafAdminRequestFilter.doFilterInternal(BroadleafAdminRequestFilter.java:59)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   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:166)
   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:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
   at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2430)
   at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2419)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:744)
[ WARN] 18:43:15 RuntimeEnvironmentPropertiesConfigurer - Unable to determine runtime environment, using default environment 'development'
[ERROR] 18:43:18 Ejb3Configuration - HHH000050: Container is providing a null PersistenceUnitRootUrl: discovery impossible
[ WARN] 18:43:18 Ejb3Configuration - HHH000144: hibernate.connection.autocommit = false breaks the EJB3 specification
[ WARN] 18:43:20 AbstractEhcacheRegionFactory - HHH020003: Could not find a specific ehcache configuration for cache named [org.hibernate.cache.spi.UpdateTimestampsCache]; using defaults.
[ WARN] 18:43:20 AbstractEhcacheRegionFactory - HHH020003: Could not find a specific ehcache configuration for cache named [org.hibernate.cache.internal.StandardQueryCache]; using defaults.
[ WARN] 18:43:21 AbstractEhcacheRegionFactory - HHH020003: Could not find a specific ehcache configuration for cache named [blSandBoxElements]; using defaults.
[ERROR] 18:43:22 Ejb3Configuration - HHH000050: Container is providing a null PersistenceUnitRootUrl: discovery impossible
[ WARN] 18:43:22 Ejb3Configuration - HHH000144: hibernate.connection.autocommit = false breaks the EJB3 specification
[ERROR] 18:43:23 Ejb3Configuration - HHH000050: Container is providing a null PersistenceUnitRootUrl: discovery impossible
[ WARN] 18:43:23 Ejb3Configuration - HHH000144: hibernate.connection.autocommit = false breaks the EJB3 specification
[ERROR] 18:43:29 Ejb3Configuration - HHH000050: Container is providing a null PersistenceUnitRootUrl: discovery impossible
[ WARN] 18:43:29 Ejb3Configuration - HHH000144: hibernate.connection.autocommit = false breaks the EJB3 specification
[ WARN] 18:43:32 DefaultFilterChainValidator - Possible error: Filters at position 12 and 13 are both instances of org.springframework.security.web.access.intercept.FilterSecurityInterceptor
[ WARN] 18:43:32 RuntimeEnvironmentPropertiesConfigurer - Unable to determine runtime environment, using default environment 'development'
[ERROR] 18:49:44 GetProductsServiceImpl - Error:
javax.persistence.EntityNotFoundException: Unable to find org.broadleafcommerce.core.catalog.domain.CategoryImpl with id 10156
   at org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound(Ejb3Configuration.java:155)
   at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:210)
   at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:260)
   at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:148)
   at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1078)
   at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1005)
   at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:651)
   at org.hibernate.type.EntityType.resolve(EntityType.java:471)
   at org.hibernate.type.EntityType.replace(EntityType.java:328)
   at org.hibernate.type.AbstractType.replace(AbstractType.java:178)
   at org.hibernate.type.TypeHelper.replace(TypeHelper.java:211)
   at org.hibernate.event.internal.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:409)
   at org.hibernate.event.internal.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:214)
   at org.hibernate.event.internal.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:282)
   at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:151)
   at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:913)
   at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:895)
   at org.hibernate.engine.spi.CascadingAction$6.cascade(CascadingAction.java:288)
   at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:387)
   at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:330)
   at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:208)
   at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:165)
   at org.hibernate.event.internal.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:424)
   at org.hibernate.event.internal.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:213)
   at org.hibernate.event.internal.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:282)
   at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:151)
   at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:76)
   at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:903)
   at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:887)
   at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:891)
   at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:889)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:366)
   at com.sun.proxy.$Proxy97.merge(Unknown Source)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:241)
   at com.sun.proxy.$Proxy97.merge(Unknown Source)
   at org.broadleafcommerce.core.catalog.dao.SkuDaoImpl.save(SkuDaoImpl.java:47)
   at org.broadleafcommerce.core.catalog.service.CatalogServiceImpl.saveSku(CatalogServiceImpl.java:196)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
   at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
   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.$Proxy134.saveSku(Unknown Source)
   at com.admin.api.service.getproducts.GetProductsServiceImpl.updateProductsToDB(GetProductsServiceImpl.java:109)
   at com.admin.api.service.getproducts.GetProductsServiceImpl.getAvailableProducts(GetProductsServiceImpl.java:82)
   at com.admin.util.controller.CustomAdminController.getProducts(CustomAdminController.java:38)
   at com.admin.util.controller.CustomAdminController$$FastClassByCGLIB$$2af94fc8.invoke(<generated>)
   at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
   at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
   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.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
   at com.admin.util.controller.CustomAdminController$$EnhancerByCGLIB$$68ec80c5.getProducts(<generated>)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
   at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
   at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
   at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
   at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
   at org.broadleafcommerce.openadmin.web.compatibility.JSCompatibilityRequestFilter.doFilterInternal(JSCompatibilityRequestFilter.java:37)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.broadleafcommerce.openadmin.security.AdminSandBoxFilter.doFilterInternal(AdminSandBoxFilter.java:70)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.broadleafcommerce.common.web.util.PrecompressedArtifactFilter.doFilter(PrecompressedArtifactFilter.java:85)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   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:166)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   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.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:91)
   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.broadleafcommerce.common.security.handler.CsrfFilter.doFilter(CsrfFilter.java:82)
   at org.broadleafcommerce.openadmin.web.filter.AdminCsrfFilter.doFilter(AdminCsrfFilter.java:38)
   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$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
   at org.broadleafcommerce.openadmin.web.filter.BroadleafAdminRequestFilter.doFilterInternal(BroadleafAdminRequestFilter.java:59)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   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:166)
   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:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
   at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2430)
   at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2419)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:744)
[ WARN] 18:55:11 RuntimeEnvironmentPropertiesConfigurer - Unable to determine runtime environment, using default environment 'development'
[ERROR] 18:55:14 Ejb3Configuration - HHH000050: Container is providing a null PersistenceUnitRootUrl: discovery impossible
[ WARN] 18:55:15 Ejb3Configuration - HHH000144: hibernate.connection.autocommit = false breaks the EJB3 specification
[ WARN] 18:55:16 AbstractEhcacheRegionFactory - HHH020003: Could not find a specific ehcache configuration for cache named [org.hibernate.cache.spi.UpdateTimestampsCache]; using defaults.
[ WARN] 18:55:16 AbstractEhcacheRegionFactory - HHH020003: Could not find a specific ehcache configuration for cache named [org.hibernate.cache.internal.StandardQueryCache]; using defaults.
[ WARN] 18:55:17 AbstractEhcacheRegionFactory - HHH020003: Could not find a specific ehcache configuration for cache named [blSandBoxElements]; using defaults.
[ERROR] 18:55:19 Ejb3Configuration - HHH000050: Container is providing a null PersistenceUnitRootUrl: discovery impossible
[ WARN] 18:55:19 Ejb3Configuration - HHH000144: hibernate.connection.autocommit = false breaks the EJB3 specification
[ERROR] 18:55:19 Ejb3Configuration - HHH000050: Container is providing a null PersistenceUnitRootUrl: discovery impossible
[ WARN] 18:55:19 Ejb3Configuration - HHH000144: hibernate.connection.autocommit = false breaks the EJB3 specification
[ERROR] 18:55:25 Ejb3Configuration - HHH000050: Container is providing a null PersistenceUnitRootUrl: discovery impossible
[ WARN] 18:55:26 Ejb3Configuration - HHH000144: hibernate.connection.autocommit = false breaks the EJB3 specification
[ WARN] 18:55:28 DefaultFilterChainValidator - Possible error: Filters at position 12 and 13 are both instances of org.springframework.security.web.access.intercept.FilterSecurityInterceptor
[ WARN] 18:55:28 RuntimeEnvironmentPropertiesConfigurer - Unable to determine runtime environment, using default environment 'development'
[ERROR] 18:56:28 GetProductsServiceImpl - Error:

Re: Not able to update the product in admin console

Posted: Thu Jan 16, 2014 12:20 pm
by henry
Here is my code what i m trying to do

This method is for saving the product and sku

Code: Select all

public saveDetails()
{
List<String> category = new ArrayList<String>( Arrays.asList(ApplicationConstants.CATEGORY));
         ProductConversion productConversion;
         for(Product product : resp.getProducts().getProduct()) {
            List<ProductOption> productOptionList = new ArrayList<ProductOption>();
            if(category.contains(product.getCategory().toUpperCase())){   
               productConversion=new ProductConversion();
               org.broadleafcommerce.core.catalog.domain.Product mainProduct=productConversion.createProduct(product);
               org.broadleafcommerce.core.catalog.domain.Product isExistProduct=catalogService.findProductById(mainProduct.getId());
               Sku sku=productConversion.addSkuToProduct(mainProduct,product,salePriceRate,retailPriceRate,catalogService.createSku());
               for(ProductOption productOption:productConversion.createProductOptions(product, mainProduct)){
                    productOption=catalogService.saveProductOption(productOption);
                    productOption.setAllowedValues(productConversion.createProductOptionValues(product, productOption));
                    productOption=catalogService.saveProductOption(productOption);   
                     productOptionList.add(productOption);
                  }
               mainProduct=catalogService.saveProduct(mainProduct);
                sku=catalogService.saveSku(sku);
               mainProduct.setDefaultSku(sku);
                mainProduct=catalogService.saveProduct(mainProduct);
                mainProduct.setProductOptions(productOptionList);
                mainProduct=catalogService.saveProduct(mainProduct);
                for(Sku skuWithProductOptions : productConversion.createSkuWithProductOptions(product, mainProduct, mainProduct.getProductOptions())){
                   catalogService.saveSku(skuWithProductOptions);
                }
               
            }
         }



Code: Select all

public class ProductConversion {

   private static final Logger logger=Logger.getLogger(ProductConversion.class);
   ProductImpl product;
   Sku sku;
   public Product createProduct(com.admin.wrapper.getproducts.resp.Product pbsProduct){
         product= new ProductImpl();
         product.setId(Long.parseLong(pbsProduct.getId()));
         product.setUrl("/"+pbsProduct.getCategory().toLowerCase()+"/image/"+pbsProduct.getImageList().getPrimaryImage().getUrl());
      
         
        /*   List<CategoryProductXref> temporary =new ArrayList<CategoryProductXref>();*/
         CategoryProductXref categoryProductXref=new CategoryProductXrefImpl();
         categoryProductXref.setCategory(getCategoryID(pbsProduct.getCategory(),product));
         categoryProductXref.setProduct(product);
      /*   temporary.add(categoryProductXref);*/
         product.getAllParentCategoryXrefs().add(categoryProductXref);
         
         Map<String, ProductAttribute> productAttributeMap=product.getProductAttributes();//new HashMap<String, ProductAttribute>();
         ProductAttribute productAttribute = new ProductAttributeImpl();
         productAttribute.setId(product.getId()+90);
         productAttribute.setName("Status");
         productAttribute.setValue("Active");
         productAttribute.setProduct(product);
         productAttributeMap.put("primary", productAttribute);
         /*ProductAttribute productAttribute1 = new ProductAttributeImpl();
         productAttribute1.setId(product.getId()+9);
         productAttribute1.setName("offerStatus");
         productAttribute1.setValue("inactive");
         productAttribute1.setProduct(product);
         productAttributeMap.put("secondary", productAttribute1);*/
         product.setProductAttributes(productAttributeMap);
      return product;
   }
   public Sku addSkuToProduct(Product product,com.admin.wrapper.getproducts.resp.Product pbsProduct,long salePriceRate,long retailPriceRate,Sku sku){
          /*    sku= new SkuImpl();*/
            sku.setId(product.getId()+50);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
            try {
               sku.setActiveStartDate(sdf.parse("2013-11-21T09:30:47+0500"));
            } catch (ParseException e) {
               //logger.error("Failed", e);
               e.printStackTrace();
            }//product.getActiveStartDate());
            sku.setAvailable(true);
            sku.setDiscountable(true);
            sku.setLongDescription(pbsProduct.getDescription());
            sku.setName(pbsProduct.getName());
            sku.setRetailPrice(calculateRetailPrice(pbsProduct.getSalePrice(),retailPriceRate));
            sku.setSalePrice(calculateSalePrice(pbsProduct.getSalePrice(),salePriceRate));
            sku.setTaxable(true);
            BroadleafCurrency broadleafCurrency=new BroadleafCurrencyImpl();
            broadleafCurrency.setCurrencyCode("KRW");
            sku.setCurrency((broadleafCurrency));
            sku.setProduct(product);
            /*List<Sku> list=new ArrayList<Sku>();
            list.add(sku);
            product.setAdditionalSkus(list);*/
            Media media= new MediaImpl();
            media.setId(product.getId()+70);
            media.setAltText("primary");
            if(pbsProduct.getDescription().length()>255){
               String str = pbsProduct.getDescription().substring(0, 254);
               media.setTitle(str);
            }
            media.setUrl(pbsProduct.getImageList().getPrimaryImage().getUrl().trim());
            Map<String, Media>   mediaMap=new HashMap<String, Media>();
            mediaMap.put("primary", media);
            sku.setSkuMedia(mediaMap);
            
      return sku;
   }
   public List<ProductOptionValue> createProductOptionValues(com.admin.wrapper.getproducts.resp.Product pbsProduct, ProductOption productOption){
      List<ProductOptionValue> list=new ArrayList<ProductOptionValue>();
      for (Object object : pbsProduct.getProductOptions()
            .getProductOptionKeys().getProductOptionKey()) {
         List<String> optionValueList = ((ProductOptions.ProductOptionKeys.ProductOptionKey) object).getValues().getValue();
         for (String str : optionValueList){
            ProductOptionValue productOptionValue=new ProductOptionValueImpl();
            productOptionValue.setAttributeValue(str);
            productOptionValue.setProductOption(productOption);
            list.add(productOptionValue);
         }      
      }
      return list;
   }
   
   public List<ProductOption> createProductOptions(com.admin.wrapper.getproducts.resp.Product pbsProduct,Product product){
      List<ProductOption> list=new ArrayList<ProductOption>();
      for (Object object : pbsProduct.getProductOptions()
            .getProductOptionKeys().getProductOptionKey()) {
         String name = ((ProductOptions.ProductOptionKeys.ProductOptionKey) object).getName();
         ProductOption productOption=new ProductOptionImpl();
          productOption.setAttributeName(name + "_" + pbsProduct.getId());
          productOption.setErrorCode(name + " required");
          productOption.setLabel(name);
          productOption.setRequired(true);
          productOption.setType("Style".equalsIgnoreCase(name) ? ProductOptionType.PRODUCT : new ProductOptionType(name.toUpperCase(),name));
          productOption.setUseInSkuGeneration(true);
          list.add(productOption);
      }
      return list;
   }
    public List<Sku> createSkuWithProductOptions(com.admin.wrapper.getproducts.resp.Product pbsProduct,Product product,List<ProductOption> productOptionList){
      List<Sku> list=new ArrayList<Sku>();
      for (Object object : pbsProduct.getProductOptions().getAvailableProductOptions().getValues().getValue()) {
         String valueText = ((ProductOptions.AvailableProductOptions.Values.Value) object).getValueText();
         Long valueId = ((ProductOptions.AvailableProductOptions.Values.Value) object).getValueId();
          Sku sku=new SkuImpl();
          List<ProductOptionValue> productOptionValueList=null;
          sku.setId(valueId);
          sku.setProduct(product);
          for(ProductOption productOption : productOptionList){
            for(ProductOptionValue productOptionValues : productOption.getAllowedValues()){
               if(productOptionValues.getAttributeValue().equalsIgnoreCase(valueText)){
                  productOptionValueList=new ArrayList<ProductOptionValue>();
                  productOptionValueList.add(productOptionValues);
                 }
            }
         sku.setProductOptionValues(productOptionValueList);
         list.add(sku);
       }
      }
      return list;
   }
 
   private Category getCategoryID (String categoryName,Product product){
   Category category=new CategoryImpl();
      Long categoryId = ApplicationConstants.CACHECACHE_ID;      
      if(categoryName.equalsIgnoreCase("MORGAN")){
         categoryId = ApplicationConstants.MORGAN_ID;
      }    
      category.setId(categoryId);
      product.setDefaultCategory(category);
       return category;      
   }

Re: Not able to update the product in admin console

Posted: Thu Jan 16, 2014 1:16 pm
by phillipuniverse
The relationship from Product to defaultCategory does not have a cascade on it:

Code: Select all


    
@ManyToOne(targetEntity CategoryImpl.class)
    @
JoinColumn(name "DEFAULT_CATEGORY_ID")
    @
Index(name="PRODUCT_CATEGORY_INDEX"columnNames={"DEFAULT_CATEGORY_ID"})
    @
AdminPresentation(friendlyName "ProductImpl_Product_Default_Category"order=4group "ProductImpl_Product_Description"requiredOverride RequiredOverride.REQUIREDgroupOrder=1)
    @
AdminPresentationToOneLookup()
    protected 
Category defaultCategory;
 


So you have to persist the category prior to setting it on the product. See if that helps any.

Re: Not able to update the product in admin console

Posted: Fri Jan 17, 2014 12:36 pm
by henry
phillipuniverse wrote:The relationship from Product to defaultCategory does not have a cascade on it:

Code: Select all


    
@ManyToOne(targetEntity = CategoryImpl.class)
    @JoinColumn(name = "DEFAULT_CATEGORY_ID")
    @Index(name="PRODUCT_CATEGORY_INDEX", columnNames={"DEFAULT_CATEGORY_ID"})
    @AdminPresentation(friendlyName = "ProductImpl_Product_Default_Category", order=4, group = "ProductImpl_Product_Description", requiredOverride = RequiredOverride.REQUIRED, groupOrder=1)
    @AdminPresentationToOneLookup()
    protected Category defaultCategory;
 


So you have to persist the category prior to setting it on the product. See if that helps any.

Hi phillip
I have tried to save the category first but i am getting stack overflow error, can u please suggest me what to save first using catalog service when saving the product.I have SKU, Media,Category,ProductAttribute,CategoryProductXref along with product to save.

Re: Not able to update the product in admin console

Posted: Tue Feb 11, 2014 5:24 am
by henry
Hi Phillip i have tried to change the code of product saving now again when i tried to update the product blank page is coming.While updating following error is coming

Code: Select all

org.broadleafcommerce.common.exception.ServiceException: Unable to fetch results for org.broadleafcommerce.core.catalog.domain.SkuImpl
   at org.broadleafcommerce.openadmin.server.service.persistence.module.MapStructurePersistenceModule.fetch(MapStructurePersistenceModule.java:557)
   at org.broadleafcommerce.openadmin.server.service.persistence.PersistenceManagerImpl.fetch(PersistenceManagerImpl.java:265)
   at org.broadleafcommerce.openadmin.server.service.DynamicEntityRemoteService.fetch(DynamicEntityRemoteService.java:106)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
   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$1.proceedWithInvocation(TransactionInterceptor.java:96)
   at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
   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.$Proxy156.fetch(Unknown Source)
   at org.broadleafcommerce.openadmin.server.service.AdminEntityServiceImpl.fetch(AdminEntityServiceImpl.java:636)
   at org.broadleafcommerce.openadmin.server.service.AdminEntityServiceImpl.getRecordsForCollection(AdminEntityServiceImpl.java:300)
   at org.broadleafcommerce.openadmin.server.service.AdminEntityServiceImpl.getRecordsForCollection(AdminEntityServiceImpl.java:262)
   at org.broadleafcommerce.openadmin.server.service.AdminEntityServiceImpl.getRecordsForAllSubCollections(AdminEntityServiceImpl.java:311)
   at org.broadleafcommerce.openadmin.web.controller.entity.AdminBasicEntityController.saveEntity(AdminBasicEntityController.java:384)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
   at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
   at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
   at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
   at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
   at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
   at org.broadleafcommerce.openadmin.web.compatibility.JSCompatibilityRequestFilter.doFilterInternal(JSCompatibilityRequestFilter.java:37)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.broadleafcommerce.openadmin.security.AdminSandBoxFilter.doFilterInternal(AdminSandBoxFilter.java:70)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.broadleafcommerce.common.web.util.PrecompressedArtifactFilter.doFilter(PrecompressedArtifactFilter.java:85)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   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:166)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   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.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:91)
   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.broadleafcommerce.common.security.handler.CsrfFilter.doFilter(CsrfFilter.java:82)
   at org.broadleafcommerce.openadmin.web.filter.AdminCsrfFilter.doFilter(AdminCsrfFilter.java:38)
   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$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
   at org.broadleafcommerce.openadmin.web.filter.BroadleafAdminRequestFilter.doFilterInternal(BroadleafAdminRequestFilter.java:59)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
   at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   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:166)
   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:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
   at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2430)
   at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2419)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
   at java.util.ArrayList.rangeCheck(ArrayList.java:635)
   at java.util.ArrayList.get(ArrayList.java:411)
   at org.broadleafcommerce.openadmin.server.service.persistence.module.MapStructurePersistenceModule.fetch(MapStructurePersistenceModule.java:555)
   ... 124 more

Re: Not able to update the product in admin console

Posted: Tue Feb 11, 2014 3:10 pm
by phillipuniverse
What version of Broadleaf are you using? This might be a bug in the framework; you could open an issue at https://github.com/broadleafcommerce/br ... rce/issues.

Before you do so, please make sure that you are using the latest 3.0 version, which is currently 3.0.9-GA. You can see release notes for each 3.0 version on the right-side column at http://docs.broadleafcommerce.org/core/ ... s/3.0.9-ga.

Re: Not able to update the product in admin console

Posted: Wed Feb 12, 2014 8:54 am
by henry
Hi phillip i resolve this issue but one more issue is coming when updating some specific product ,we are sending the LongDescription in format of html

Code: Select all

 
<p>&nbsp;</p>
<table width="700" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><a href="http://www.gsshop.com/frenchplace?lseq=394644" target="_blank"><img src="http://image.gsshop.com/image/12/35/12358944_1385021654804.jpg"  align="bottom" width="700" height="372" border="0" /></a></td>
  </tr>
  <tr>
    <td><img src="http://image.gsshop.com/image/12/35/12358944_1385021654960.jpg" width="700" height="390" /></td>
  </tr>
  <tr>
    <td><img src="http://image.gsshop.com/image/12/35/12358944_1385021655289.jpg" width="700" height="110" /></td>
  </tr>
  <tr>
    <td><img src="http://image.gsshop.com/image/12/35/12358944_1385021655460.jpg" /></td>
  </tr>
  <tr>
    <td><img src="http://image.gsshop.com/image/12/35/12358944_1385021655679.jpg" /></td>
  </tr>
    <tr>
    <td><img src="http://image.gsshop.com/image/12/35/12358944_1385021656070.jpg" /></td>
  </tr>
  <tr>
    <td><img src="http://image.gsshop.com/image/12/35/12358944_1385021656460.jpg" /></td>
  </tr>
  <tr>
    <td><img src="http://image.gsshop.com/image/12/35/12358944_1385021657023.jpg" width="700" height="400" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<!-- Save for Web Slices (cachecache_까쉐까쉐01.psd - Slices: 1, 2, 3-1, 3-2, 3-3, 3-4, 4) -->
<!-- End Save for Web Slices -->
and storing it into SKU table column LONG_DESCRIPTION .There is align attribute in html which is not supported because of this error is coming when i remove align attribute then its updating well so please tell me is there any way to lower the version of html in admin cause html5 is not supported align attribute

Re: Not able to update the product in admin console

Posted: Thu Feb 13, 2014 4:18 pm
by phillipuniverse
This is probably a fault of the anti-samy exploitation service. You can disable it by putting this in an applicationContext-admin.xml:

[code=xml]
<bean id="blExploitProtectionService" class="org.broadleafcommerce.common.security.service.ExploitProtectionServiceImpl">
<property name="xssProtectionEnabled" value="false" />
</bean>

Re: Not able to update the product in admin console

Posted: Mon Apr 14, 2014 8:14 am
by henry
Hi phillips
I have tried to implement your way its working fine for update the product

Code: Select all

<bean id="blExploitProtectionService" class="org.broadleafcommerce.common.security.service.ExploitProtectionServiceImpl">
<property name="xssProtectionEnabled" value="false" />
</bean>


But my concern is does it break blc xss security feature or other security feature( I don't want to break any security feature of blc).Is there any way around to achieve the same .

Re: Not able to update the product in admin console

Posted: Tue Apr 22, 2014 11:52 am
by phillipuniverse
It just sort of depends on what your security is around your admin panel. If your admin panel is behind some firewall somewhere then it's extremely unlikely that somebody would be able to get into the admin panel and put in some rogue Javascript or HTML that you didn't intend into an entity field. If it's not behind a firewall then your risk is a bit greater but still not that bad in my opinion.

If you still want this security feature and want to change what is allowed, you can change the antiSamyPolicyFileLocation property:

Code: Select all

<bean id="blExploitProtectionService" class="org.broadleafcommerce.common.security.service.ExploitProtectionServiceImpl">
    <property name="antiSamyPolicyFileLocation" value="classpath:path/to/some/antisamy.xml" />
</bean>


We distribute 2 policy files: https://github.com/BroadleafCommerce/Br ... -1.4.4.xml and https://github.com/BroadleafCommerce/Br ... -1.4.4.xml. The Myspace one is hooked up by default. You can use these as a basis to form your own rules about what you allow and what you don't.