Skip to Content
author's profile photo Former Member
Former Member

save item in interceptor

Hello! I got a following Exception when I save item in my Interceptor.

 ERROR () () [GenericItemCreateAction] create(...): Exception occured during creation process! de.hybris.platform.servicelayer.exceptions.ModelSavingException: already got modification listener de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter$MyHistoryListenerAdapter@b32f151 - cannot set de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter$MyHistoryListenerAdapter@7e3fac05
  de.hybris.platform.servicelayer.exceptions.ModelSavingException: already got modification listener de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter$MyHistoryListenerAdapter@b32f151 - cannot set de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter$MyHistoryListenerAdapter@7e3fac05
      at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.saveAll(DefaultModelService.java:609)
      at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.saveAll(DefaultModelService.java:555)
      at de.hybris.platform.servicelayer.hmc.ServicelayerHMCCreateAction.create(ServicelayerHMCCreateAction.java:128)
      at de.hybris.platform.hmc.util.action.CreateAction.perform(CreateAction.java:196)
      at de.hybris.platform.hmc.generic.GenericItemCreatorChip.performSave(GenericItemCreatorChip.java:82)
      at de.hybris.platform.hmc.ItemChip.save(ItemChip.java:224)
      at de.hybris.platform.hmc.ItemChip.processEvents(ItemChip.java:377)
      at de.hybris.platform.hmc.AbstractToolbarChip.processEvents(AbstractToolbarChip.java:116)
      at de.hybris.platform.hmc.AbstractToolbarActionChip.processEvents(AbstractToolbarActionChip.java:135)
      at de.hybris.platform.hmc.webchips.DisplayState.dispatchEvents(DisplayState.java:634)
      at de.hybris.platform.hmc.webchips.DisplayState.extractEventsFromParameters(DisplayState.java:443)
      at de.hybris.platform.hmc.webchips.DisplayState.processEvents(DisplayState.java:354)
      at de.hybris.platform.hmc.webchips.MasterServlet.process(MasterServlet.java:195)
      at de.hybris.platform.hmc.webchips.MasterServlet.doPost(MasterServlet.java:84)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:256)
      at de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$StatisticsGatewayFilter.doFilter(AbstractPlatformFilterChain.java:345)
      at de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
      at de.hybris.platform.servicelayer.web.SecureMediaFilter.doFilter(SecureMediaFilter.java:97)
      at de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
      at de.hybris.platform.servicelayer.web.DynamicCatalogVersionActivationFilter.doFilter(DynamicCatalogVersionActivationFilter.java:93)
      at de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
      at de.hybris.platform.servicelayer.web.DataSourceSwitchingFilter.doFilter(DataSourceSwitchingFilter.java:73)
      at de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
      at de.hybris.platform.servicelayer.web.SessionFilter.doFilter(SessionFilter.java:73)
      at de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
      at de.hybris.platform.servicelayer.web.RedirectWhenSystemIsNotInitializedFilter.doFilter(RedirectWhenSystemIsNotInitializedFilter.java:104)
      at de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
      at de.hybris.platform.servicelayer.web.DynamicTenantSwitchingFilter.doFilterInternal(DynamicTenantSwitchingFilter.java:88)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
      at de.hybris.platform.servicelayer.web.Log4JFilter.doFilter(Log4JFilter.java:47)
      at de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain$InternalFilterChain.doFilter(AbstractPlatformFilterChain.java:226)
      at de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain.doFilterInternal(AbstractPlatformFilterChain.java:156)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      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:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at de.hybris.platform.servicelayer.web.XSSFilter.doFilter(XSSFilter.java:230)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: java.lang.IllegalStateException: already got modification listener de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter$MyHistoryListenerAdapter@b32f151 - cannot set de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter$MyHistoryListenerAdapter@7e3fac05
      at de.hybris.platform.servicelayer.internal.model.impl.ModelValueHistory.setListener(ModelValueHistory.java:177)
      at de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter.addModelModificationListener(ItemModelConverter.java:414)
      at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelContext.afterPersist(DefaultModelContext.java:99)
      at de.hybris.platform.servicelayer.internal.model.impl.ModelContextProxy.afterPersist(ModelContextProxy.java:105)
      at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.postProcessJaloSavedItems(DefaultModelService.java:1065)
      at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.doJaloPersistence(DefaultModelService.java:650)
      at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.persistWrappers(DefaultModelService.java:1002)
      at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.performPersistenceOperations(DefaultModelService.java:626)
      at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.saveAllInternal(DefaultModelService.java:620)
      at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.saveAll(DefaultModelService.java:600)

does any body know how to resolve this exception ?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 31, 2015 at 09:11 AM

    I resolved by myself. I should not call save method in interceptor, like this.

     context.getModelService().save(item);
    
    

    I just set a value to the item and leave them. then the item and value is saved in db.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 27, 2015 at 08:44 AM

    If your item is new created and it has relation to other item and you may get stack over flow

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.