Bug 861237 - ResourceManager.getLiveResourceAvailability fails due to PersistentObjectException: detached entity passed to persist: org.rhq.core.domain.configuration.definition.ConfigurationDefinition
Summary: ResourceManager.getLiveResourceAvailability fails due to PersistentObjectExce...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: CLI
Version: JON 3.1.0
Hardware: All
OS: All
high
high
Target Milestone: ---
: JON 3.1.2
Assignee: Heiko W. Rupp
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On: 861239
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-27 21:45 UTC by Larry O'Leary
Modified: 2018-11-29 21:19 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
: 861239 (view as bug list)
Environment:
Last Closed: 2013-09-11 11:01:18 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Proposed patch (5.80 KB, patch)
2012-11-14 15:46 UTC, Heiko W. Rupp
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 224463 0 None None None 2012-09-27 21:55:51 UTC

Description Larry O'Leary 2012-09-27 21:45:42 UTC
Description of problem:
Can not execute ResourceManager.getLiveResourceAvailability from CLI or Remote API due to:

Caused by: org.hibernate.PersistentObjectException: detached entity passed to persist: org.rhq.core.domain.configuration.definition.ConfigurationDefinition
	at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:79)
	at org.hibernate.impl.SessionImpl.firePersistOnFlush(SessionImpl.java:644)
	at org.hibernate.impl.SessionImpl.persistOnFlush(SessionImpl.java:636)
	at org.hibernate.engine.CascadingAction$9.cascade(CascadingAction.java:323)
	at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
	at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
	at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
	at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
	at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
	at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:122)
	at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
	at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:515)
	... 101 more


Version-Release number of selected component (if applicable):
JON 3.1

How reproducible:
Always

Steps to Reproduce:
1. Install JON system and add one or more resources to inventory
2. Locate a valid resource ID for a resource in inventory - probably 10001
3. Execute the following from the JON CLI:

ResourceManager.getLiveResourceAvailability(10001)

  
Actual results:
        Wrapped java.lang.RuntimeException: [Warning] javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state (<Unknown source>#1)
ResourceManager.getLiveResourceAvailability(10001) 
^


Expected results:
The live availability for the resource with ID 10001 (in my case Platform).

Comment 1 Heiko W. Rupp 2012-11-14 15:46:06 UTC
Created attachment 644969 [details]
Proposed patch

An additional entityManager.flush() makes the issue go away for me.

Comment 2 Heiko W. Rupp 2012-11-19 11:02:50 UTC
Proposed patch is now in master as 23be83c54ea7c

Comment 3 Heiko W. Rupp 2012-11-19 14:02:04 UTC
Pushed to the release branch as 94abac1c47b4c9f

Comment 4 Simeon Pinder 2012-11-21 21:56:15 UTC
Moving to ON_QA as available for test with build : https://brewweb.devel.redhat.com//buildinfo?buildID=244662.

Comment 5 Filip Brychta 2012-11-26 12:51:15 UTC
Verified on 3.1.2.ER2


Note You need to log in before you can comment on or make changes to this bug.