Project

General

Profile

bug #9095

LazyInitializationException (LIE) in portal/description/distributionInfoFor/{uuid}

Added by Andreas Kohlbecker 4 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Highest
Category:
cdmlib-remote
Target version:
Start date:
06/25/2020
Due date:
% Done:

100%

Severity:
critical
Found in Version:

Description

test links:

e.g.:

08:30:33.732 [cichorieae] [qtp527446182-2483] INFO e.e.c.r.c.BaseListController - doGetDistributionInfo() - GET: /cichorieae/portal/description/distributionInfoFor/5d65f017-0c23-43e4-888d-9649de50dd45.json?recipe=EuroPlusMed&statusOrderPreference=
1&subAreaPreference=1&hiddenAreaMarkerType=&part=mapUriParams&part=tree&omitLevels=38efa5fd-d7f0-451c-9de9-e6cce41e2225

Caused by: net.sf.json.JSONException: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: eu.etaxonomy.cdm.model.agent.Team.teamMembers, could not initialize proxy - no Session
        at net.sf.json.JSONObject._fromBean(JSONObject.java:692)
        at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
        at eu.etaxonomy.cdm.remote.json.processor.bean.HibernateProxyBeanProcessor.processBean(HibernateProxyBeanProcessor.java:28)
        at net.sf.json.JSONObject._fromBean(JSONObject.java:676)
        at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
        at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:274)
        at net.sf.json.JSONObject._processValue(JSONObject.java:2655)
        at net.sf.json.JSONObject.processValue(JSONObject.java:2721)
        at net.sf.json.JSONObject.element(JSONObject.java:1786)
        at eu.etaxonomy.cdm.remote.json.processor.bean.AbstractBeanProcessor.processBean(AbstractBeanProcessor.java:149)
        at net.sf.json.JSONObject._fromBean(JSONObject.java:676)
        at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
        at eu.etaxonomy.cdm.remote.json.processor.bean.HibernateProxyBeanProcessor.processBean(HibernateProxyBeanProcessor.java:28)
        at net.sf.json.JSONObject._fromBean(JSONObject.java:676)
        at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
        at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:274)
        at net.sf.json.JSONObject._processValue(JSONObject.java:2655)
        at net.sf.json.JSONObject.processValue(JSONObject.java:2721)
        at net.sf.json.JSONObject.setInternal(JSONObject.java:2736)
        at net.sf.json.JSONObject.setValue(JSONObject.java:1424)
        at net.sf.json.JSONObject.defaultBeanProcessing(JSONObject.java:765)
        at net.sf.json.JSONObject._fromBean(JSONObject.java:699)
        at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
        at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:274)
        at net.sf.json.JSONArray._processValue(JSONArray.java:2513)
        at net.sf.json.JSONArray.processValue(JSONArray.java:2538)
        at net.sf.json.JSONArray.addValue(JSONArray.java:2525)
        at net.sf.json.JSONArray._fromCollection(JSONArray.java:1056)
        at net.sf.json.JSONArray.fromObject(JSONArray.java:123)
        at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:240)
        at net.sf.json.JSONObject._processValue(JSONObject.java:2655)
        at net.sf.json.JSONObject.processValue(JSONObject.java:2721)
        at net.sf.json.JSONObject.element(JSONObject.java:1786)
        at eu.etaxonomy.cdm.remote.json.processor.bean.AbstractBeanProcessor.processBean(AbstractBeanProcessor.java:151)
        at net.sf.json.JSONObject._fromBean(JSONObject.java:676)
        at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
        at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:274)
        at net.sf.json.JSONArray._processValue(JSONArray.java:2513)
        at net.sf.json.JSONArray.processValue(JSONArray.java:2538)
        at net.sf.json.JSONArray.addValue(JSONArray.java:2525)
        at net.sf.json.JSONArray._fromCollection(JSONArray.java:1056)
        at net.sf.json.JSONArray.fromObject(JSONArray.java:123)
        at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:240)
        at net.sf.json.JSONObject._processValue(JSONObject.java:2655)
        at net.sf.json.JSONObject.processValue(JSONObject.java:2721)
        at net.sf.json.JSONObject.element(JSONObject.java:1786)
        at eu.etaxonomy.cdm.remote.json.processor.bean.AbstractBeanProcessor.processBean(AbstractBeanProcessor.java:153)
        at net.sf.json.JSONObject._fromBean(JSONObject.java:676)
        at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
        at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:274)
        at net.sf.json.JSONArray._processValue(JSONArray.java:2513)
        at net.sf.json.JSONArray.processValue(JSONArray.java:2538)
        at net.sf.json.JSONArray.addValue(JSONArray.java:2525)
        at net.sf.json.JSONArray._fromCollection(JSONArray.java:1056)
        at net.sf.json.JSONArray.fromObject(JSONArray.java:123)
        at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:240)
        at net.sf.json.JSONObject._processValue(JSONObject.java:2655)
        at net.sf.json.JSONObject.processValue(JSONObject.java:2721)
        at net.sf.json.JSONObject.element(JSONObject.java:1786)
        at eu.etaxonomy.cdm.remote.json.processor.bean.AbstractBeanProcessor.processBean(AbstractBeanProcessor.java:151)
        at net.sf.json.JSONObject._fromBean(JSONObject.java:676)
        at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
        at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:274)
        at net.sf.json.JSONArray._processValue(JSONArray.java:2513)
        at net.sf.json.JSONArray.processValue(JSONArray.java:2538)
        at net.sf.json.JSONArray.addValue(JSONArray.java:2525)
        at net.sf.json.JSONArray._fromCollection(JSONArray.java:1056)
        at net.sf.json.JSONArray.fromObject(JSONArray.java:123)
        at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:240)
        at net.sf.json.JSONObject._processValue(JSONObject.java:2655)
        at net.sf.json.JSONObject.processValue(JSONObject.java:2721)
        at net.sf.json.JSONObject.element(JSONObject.java:1786)
        at eu.etaxonomy.cdm.remote.json.processor.bean.AbstractBeanProcessor.processBean(AbstractBeanProcessor.java:151)
        at net.sf.json.JSONObject._fromBean(JSONObject.java:676)
        at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
        at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:274)
        at net.sf.json.JSONArray._processValue(JSONArray.java:2513)
        at net.sf.json.JSONArray.processValue(JSONArray.java:2538)
        at net.sf.json.JSONArray.addValue(JSONArray.java:2525)
        at net.sf.json.JSONArray._fromCollection(JSONArray.java:1056)
        at net.sf.json.JSONArray.fromObject(JSONArray.java:123)
        at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:240)
        at net.sf.json.JSONObject._processValue(JSONObject.java:2655)
        at net.sf.json.JSONObject.processValue(JSONObject.java:2721)
        at net.sf.json.JSONObject.element(JSONObject.java:1786)
        at eu.etaxonomy.cdm.remote.json.processor.bean.AbstractBeanProcessor.processBean(AbstractBeanProcessor.java:151)
        at net.sf.json.JSONObject._fromBean(JSONObject.java:676)
        at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
        at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:274)
        at net.sf.json.JSONObject._processValue(JSONObject.java:2655)
        at net.sf.json.JSONObject.processValue(JSONObject.java:2721)
        at net.sf.json.JSONObject.setInternal(JSONObject.java:2736)
        at net.sf.json.JSONObject.setValue(JSONObject.java:1424)
        at net.sf.json.JSONObject.defaultBeanProcessing(JSONObject.java:765)
        at net.sf.json.JSONObject._fromBean(JSONObject.java:699)
        at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
        at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:274)
        at net.sf.json.JSONObject._processValue(JSONObject.java:2655)
        at net.sf.json.JSONObject.processValue(JSONObject.java:2721)
        at net.sf.json.JSONObject.setInternal(JSONObject.java:2736)
        at net.sf.json.JSONObject.setValue(JSONObject.java:1424)
        at net.sf.json.JSONObject.defaultBeanProcessing(JSONObject.java:765)
        at net.sf.json.JSONObject._fromBean(JSONObject.java:699)
        at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
        at eu.etaxonomy.cdm.remote.view.JsonView.render(JsonView.java:128)
        at eu.etaxonomy.cdm.remote.view.JsonView.render(JsonView.java:188)
        at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1243)
        at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
        ... 80 common frames omitted
Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: eu.etaxonomy.cdm.model.agent.Team.teamMembers, could not initialize proxy - no Session
        at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:567)
        at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:205)
        at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:546)
        at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:133)
        at org.hibernate.collection.internal.PersistentList.iterator(PersistentList.java:132)
        at eu.etaxonomy.cdm.strategy.cache.agent.TeamDefaultCacheStrategy.getNomenclaturalTitle(TeamDefaultCacheStrategy.java:82)
        at eu.etaxonomy.cdm.strategy.cache.agent.TeamDefaultCacheStrategy.getNomenclaturalTitle(TeamDefaultCacheStrategy.java:1)
        at eu.etaxonomy.cdm.model.agent.Team.getNomenclaturalTitle(Team.java:270)
        at eu.etaxonomy.cdm.remote.json.processor.bean.TeamOrPersonBaseBeanProcessor.processBeanSecondStep(TeamOrPersonBaseBeanProcessor.java:40)
        at eu.etaxonomy.cdm.remote.json.processor.bean.TeamOrPersonBaseBeanProcessor.processBeanSecondStep(TeamOrPersonBaseBeanProcessor.java:22)
        at eu.etaxonomy.cdm.remote.json.processor.bean.AbstractBeanProcessor.processBean(AbstractBeanProcessor.java:167)
        at net.sf.json.JSONObject._fromBean(JSONObject.java:676)
        ... 190 common frames omitted

Related issues

Duplicated by Edit - bug #9096: LazyInitializationException (LIE) in DescriptionElementListController.getDescriptionElementsForTaxon() Duplicate 06/25/2020

Associated revisions

Revision af4969c8 (diff)
Added by Andreas Kohlbecker 4 months ago

ref #9095, ref #9096 catching LIEs at Team.members in TeamOrPersonBaseBeanProcessor to handle problems potentially originating from bug ref #7331

Revision a8905b5d (diff)
Added by Andreas Kohlbecker 4 months ago

reverting commit last for ref #9095, ref #9096, ref #7331 for a better solution

Revision d2a8e3bf (diff)
Added by Andreas Kohlbecker 4 months ago

ref #9095 falling back to explicite bean property intialization for TeamOrPersonBase

Revision b6bea419 (diff)
Added by Andreas Kohlbecker 4 months ago

ref #9095 improving AdvancedBeanInitializer performance by using Optional instead of Exceptions

History

#1 Updated by Andreas Kohlbecker 4 months ago

  • Related to bug #9096: LazyInitializationException (LIE) in DescriptionElementListController.getDescriptionElementsForTaxon() added

#2 Updated by Andreas Kohlbecker 4 months ago

it apends at DistributionInfoDTO.tree.children.children.children.data.sources.citation.authorship.nomenclaturalTitle.teamMembers

#3 Updated by Andreas Kohlbecker 4 months ago

this problem is potentially highly related to #7331 since the init strategy includes the sources.citation.authorship:

[DescriptionElementListPortalController.java]

protected static final List<String> DESCRIPTION_ELEMENT_INIT_STRATEGY = Arrays.asList(new String []{
            "$",
            "annotations",
            "markers",
            "stateData.$",
            "statisticalValues.*",
            "sources.citation.authorship",
            "sources.nameUsedInSource",
            "multilanguageText",
            "media",
            "name.$",
            "name.rank.representations",
            "name.status.type.representations",
            "taxon2.name"
    });

#4 Updated by Andreas Kohlbecker 4 months ago

  • Related to bug #7331: AdvancedBeanInitializer fails to initialize properties of preinitialized beans in the graph in very special situations added

#5 Updated by Andreas Kohlbecker 4 months ago

  • Related to deleted (bug #9096: LazyInitializationException (LIE) in DescriptionElementListController.getDescriptionElementsForTaxon())

#6 Updated by Andreas Kohlbecker 4 months ago

  • Duplicated by bug #9096: LazyInitializationException (LIE) in DescriptionElementListController.getDescriptionElementsForTaxon() added

#7 Updated by Andreas Kohlbecker 4 months ago

  • Description updated (diff)

#8 Updated by Andreas Kohlbecker 4 months ago

  • Description updated (diff)

#9 Updated by Andreas Kohlbecker 4 months ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 50

solved by catching the exception in the TeamOrPersonBaseBeanProcessor since a real solution (#7331) may need some more time

#10 Updated by Andreas Kohlbecker 4 months ago

  • Related to deleted (bug #7331: AdvancedBeanInitializer fails to initialize properties of preinitialized beans in the graph in very special situations)

#11 Updated by Andreas Kohlbecker 4 months ago

the cause for this bug was not related to #7331 but is caused by an unexpected behavior of AdvancedBeanInitializer.preparePropertyValueForBulkLoadOrStore(BeanInitNode node, Object parentBean, String param, Object propertyValue) which always only returns TeamOrPersonBase making Team and Person indistinguishable in the TeamAutoInitializer.

Now that this is solved initialization strategies for authorship.teamMembers and authorship.$ are most probably dispensible and should be removed or truncated: Candidates are in

  • cdmlib: ReferenceEllypsisFormatter, DescriptionListPortalController, NameCatalogueController, DescriptionPortalController.java (3 matches), NameController.java (5 matches), NamePortalController.java (4 matches), ReferenceController.java (2 matches), TypeDesignationPortalController.java (4 matches)
  • cdm-vaadin:RegistrationWorkflowService, SpecimenTypeDesignationWorkingSetServiceImpl, DistributionStatusQuery, DistributionTablePresenter,

#12 Updated by Andreas Kohlbecker 4 months ago

moreover the whole reference object as serialized in webservice responses can be simplified a lot. The authorship and authorship.teamMembers are not use anywhere in the portal. We could actually return very simple ReferenceDTOs instead. required fields only are:

uuid
titleCache
doi
uri
type

#13 Updated by Andreas Kohlbecker 4 months ago

  • Status changed from Resolved to In Progress
  • % Done changed from 50 to 40

the last a8905b5d also causes Problems since TeamAutoInitializer needs to distinguish Team and Person to avoid
in order to avoid org.hibernate.QueryException: could not resolve property: teamMembers of: eu.etaxonomy.cdm.model.agent.Person

The root casue of all of this seems to be ((HibernateProxy)propertyValue).getHibernateLazyInitializer().getPersistentClass(); in AdvancedBeanInitializer.preparePropertyValueForBulkLoadOrStore(BeanInitNode node, Object parentBean, String param, Object propertyValue) which always only returns TeamOrPersonBase

#14 Updated by Andreas Kohlbecker 4 months ago

  • Status changed from In Progress to Resolved
  • Target version changed from Release 5.18 to Release 5.16
  • % Done changed from 40 to 60

#15 Updated by Andreas Kohlbecker 4 months ago

  • Status changed from Resolved to Closed
  • % Done changed from 60 to 100

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)