On 29 April 2014 21:34, GESCONSULTOR - Óscar Bou <o....@gesconsultor.com>wrote:
> > Yes... relMgr is what I find to be null... > > I noticed it sometimes worked, sometimes not... I thought about a limit in > nested transactions or something similar... But I didn't noticed it was a > ConcurrentMap. > > The only option seems the one you pointed. The Map has been cleared and > not initialized on: > > if (getManageRelations() && managedRelationDetails != null) > { > managedRelationDetails.clear(); > } > > > I think it's probably worth asking on the DN forum (Andy Jefferson). Say you work with me. He'll probably ask for a test case, but I guess you could explain that's intermittent and possibly a threading issue. Also, do note that we're not on the latest version of DN; very outside change that it's a bug that's been recently fixed. > > While trying as a workaround to "hide" the exception in a try - catch > block, as in: > > > // Send pending changes to the database. > try { > this.getContainer().flush(); > } catch (final NullPointerException e) { > // Do nothing... Seems there's a bug in DN when updating > Managed > // Relationships. > // It only occurs sometimes (it's lacy loaded; it's a > multi-threaded > // ConcurrentMap. > System.err.print(String.format("XMS - FLUSING ERROR !!!: %s", > e.getStackTrace().toString())); > } > > > > Then the Isis transaction was not in the correct state: > > Caused by: java.lang.IllegalStateException: state is: MUST_ABORT > at > org.apache.isis.core.commons.ensure.Ensure.ensureThatState(Ensure.java:111) > at > org.apache.isis.core.runtime.system.transaction.IsisTransaction.flush(IsisTransaction.java:363) > > at > org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.flushTransaction(IsisTransactionManager.java:311) > at > org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession$7.flush(RuntimeContextFromSession.java:223) > at > org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault.flush(DomainObjectContainerDefault.java:229) > > Not sure how to deal with it ... > > > > Not sure I recommend this, but if you want to hack it, you could register a custom implementation of DomainObjectContainer that resets the IsisTransaction back to a good state (setState to IN_PROGRESS and setAbortCause to null. in isis.properties: isis.persistor.domain-object-container=org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault change as required... As I say, rather hacky, not sure it's to be recommended. Dan