SAP Knowledge Base Article - Preview

2401783 - org.hibernate.LazyInitializationException when using IntegrationKeyGenerator.calculateIntegrationKeyFromRawItem()

Symptom

When calling com.hybris.datahub.composition.key.IntegrationKeyGenerator.calculateIntegrationKeyFromRawItem() from custom GroupingHandler inside transaction like this:

TransactionTemplate template = new TransactionTemplate(transactionManager);
template.setReadOnly(true);
template.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
return template.execute(transactionStatus -> {
return integrationKeyGenerator.calculateIntegrationKeyFromRawItem("SpecificationProductFeatureCanonical", raw);
});

after some period of time you can see this exception:

[ERROR] [c.h.d.a.GroupingHandlerLogger] Could not group
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.hybris.datahub.domain.jpa.entities.CanonicalAttributeModelDefinitionEntity.canonicalAttributeTransformationDefinitionEntities, could not initialize proxy - no Session
  at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:575) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
  at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:214) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
  at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:554) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
  at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:142) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
  at org.hibernate.collection.internal.PersistentSet.iterator(PersistentSet.java:180) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
  at java.util.Spliterators$IteratorSpliterator.estimateSize(Spliterators.java:1821) ~[na:1.8.0_60]
  at java.util.Spliterator.getExactSizeIfKnown(Spliterator.java:408) ~[na:1.8.0_60]
  at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:480) ~[na:1.8.0_60]
  at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_60]
  at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_60]
  at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_60]
  at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[na:1.8.0_60]
  at com.hybris.datahub.domain.jpa.entities.CanonicalAttributeModelDefinitionEntity.getCanonicalAttributeTransformationDefinitions(CanonicalAttributeModelDefinitionEntity.java:105) ~[datahub-entity-6.2.0.1-RC1.jar:6.2.0.1-RC1]
  at com.hybris.datahub.composition.key.DefaultIntegrationKeyGenerator.containsAttributeDefinition(DefaultIntegrationKeyGenerator.java:139) ~[datahub-service-6.2.0.1-RC1.jar:6.2.0.1-RC1]
  at com.hybris.datahub.composition.key.DefaultIntegrationKeyGenerator.lambda$getKeyAttributesFromRawItem$119(DefaultIntegrationKeyGenerator.java:102) ~[datahub-service-6.2.0.1-RC1.jar:6.2.0.1-RC1]
  at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) ~[na:1.8.0_60]
  at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) ~[na:1.8.0_60]
  at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[na:1.8.0_60]
  at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_60]
  at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[na:1.8.0_60]
  at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[na:1.8.0_60]
  at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_60]
  at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[na:1.8.0_60]
  at com.hybris.datahub.composition.key.DefaultIntegrationKeyGenerator.getKeyAttributesFromRawItem(DefaultIntegrationKeyGenerator.java:103) ~[datahub-service-6.2.0.1-RC1.jar:6.2.0.1-RC1]
  at com.hybris.datahub.composition.key.DefaultIntegrationKeyGenerator.calculateIntegrationKeyFromRawItem(DefaultIntegrationKeyGenerator.java:62) ~[datahub-service-6.2.0.1-RC1.jar:6.2.0.1-RC1]
  at com.hybris.datahub.composition.EmptyFeatureValueCompositonHandler.lambda$buildIntegrationKey$0(EmptyFeatureValueCompositonHandler.java:64) ~[specifications-canonical-release-SNAPSHOT.jar:na]
  at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) ~[spring-tx-4.2.7.RELEASE.jar:4.2.7.RELEASE]
  at com.hybris.datahub.composition.EmptyFeatureValueCompositonHandler.buildIntegrationKey(EmptyFeatureValueCompositonHandler.java:62) ~[specifications-canonical-release-SNAPSHOT.jar:na]
  at com.hybris.datahub.composition.EmptyFeatureValueCompositonHandler.group(EmptyFeatureValueCompositonHandler.java:44) ~[specifications-canonical-release-SNAPSHOT.jar:na]
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
  at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
  at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) ~[spring-aop-4.2.7.RELEASE.jar:4.2.7.RELEASE]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) [spring-aop-4.2.7.RELEASE.jar:4.2.7.RELEASE]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) [spring-aop-4.2.7.RELEASE.jar:4.2.7.RELEASE]
  at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) ~[spring-aop-4.2.7.RELEASE.jar:4.2.7.RELEASE]
  at com.hybris.datahub.aop.GroupingHandlerLogger.aroundGroupAdvice(GroupingHandlerLogger.java:42) ~[datahub-service-6.2.0.1-RC1.jar:6.2.0.1-RC1]
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
  at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
  at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:620) [spring-aop-4.2.7.RELEASE.jar:4.2.7.RELEASE]
  at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:609) [spring-aop-4.2.7.RELEASE.jar:4.2.7.RELEASE]
  at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68) [spring-aop-4.2.7.RELEASE.jar:4.2.7.RELEASE]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.2.7.RELEASE.jar:4.2.7.RELEASE]
  at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) [spring-aop-4.2.7.RELEASE.jar:4.2.7.RELEASE]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.2.7.RELEASE.jar:4.2.7.RELEASE]
  at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) [spring-aop-4.2.7.RELEASE.jar:4.2.7.RELEASE]
  at com.sun.proxy.$Proxy130.group(Unknown Source) [na:na]
  at com.hybris.datahub.grouping.impl.CompositionGroupSplitter.extractGroups(CompositionGroupSplitter.java:94) [datahub-service-akka-6.2.0.1-RC1.jar:6.2.0.1-RC1]
  at com.hybris.datahub.grouping.impl.CompositionGroupSplitter.groupItems(CompositionGroupSplitter.java:75) [datahub-service-akka-6.2.0.1-RC1.jar:6.2.0.1-RC1]
  at akka.japi.pf.UnitCaseStatement.apply(CaseStatements.scala:26) ~[akka-actor_2.11-2.4.8.jar:na]
  at akka.japi.pf.UnitCaseStatement.apply(CaseStatements.scala:21) ~[akka-actor_2.11-2.4.8.jar:na]
  at scala.PartialFunction$class.applyOrElse(PartialFunction.scala:123) ~[scala-library-2.11.5.jar:na]
  at akka.japi.pf.UnitCaseStatement.applyOrElse(CaseStatements.scala:21) ~[akka-actor_2.11-2.4.8.jar:na]
  at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:170) ~[scala-library-2.11.5.jar:na]
  at akka.actor.Actor$class.aroundReceive(Actor.scala:484) ~[akka-actor_2.11-2.4.8.jar:na]
  at akka.actor.AbstractActor.aroundReceive(AbstractActor.scala:47) ~[akka-actor_2.11-2.4.8.jar:na]
  at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526) ~[akka-actor_2.11-2.4.8.jar:na]
  at akka.actor.ActorCell.invoke(ActorCell.scala:495) ~[akka-actor_2.11-2.4.8.jar:na]
  at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) ~[akka-actor_2.11-2.4.8.jar:na]
  at akka.dispatch.Mailbox.run(Mailbox.scala:224) ~[akka-actor_2.11-2.4.8.jar:na]
  at akka.dispatch.Mailbox.exec(Mailbox.scala:234) ~[akka-actor_2.11-2.4.8.jar:na]
  at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) ~[scala-library-2.11.5.jar:na]
  at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) ~[scala-library-2.11.5.jar:na]
  at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) ~[scala-library-2.11.5.jar:na]
  at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) ~[scala-library-2.11.5.jar:na]


Read more...

Environment

Data Hub 6.2

Product

SAP Hybris Commerce 6.2

Keywords

KBA , CEC-COM-HUB , SAP Commerce Data Hub , Bug Filed

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP ONE Support launchpad (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.