Hi Chuck

Thanks, see below...


> 
> 
>> Hi
>> 
>> I have just had an exception thrown on some relatively recent code, that has 
>> worked fine until now..
>> 
>> java.lang.IllegalStateException:  Cannot obtain globalId for an object which 
>> is registered in its editingContext, 
>> object: <indoc.app.entities.Container pk:"496">, 
>> databaseContext: er.extensions.eof.ERXDatabaseContext@ee260b, 
>> object's editingContext: er.extensions.eof.ERXEC@1fe6055, 
>> databaseContext's active editingContext: null
> 
> That last part:
>> databaseContext's active editingContext: null
> 
> Indicates the problem.

Yeah, I just don't quite understand what "active editingContext" means to the 
databaseContext or how it can be null.

> 
> 
>> Context:
>> 
>> This is part of a background notification system which works roughly like:
>> 
>> 1) NSNotificationCenter triggers a callback that...
>> 
>> 2) Creates a new Runnable and globalIds of objects are passed into this 
>> runnable from their original editing context.  A ThreadPoolExecutor the 
>> executes the thread.
>> 
>> 3) The new thread creates a new editing context that uses an 
>> ERXRoundRobinCollection to grab an EOObjectStoreCoordinator.  This 
>> EOObjectStoreCoordinator is only used in the notification part of the 
>> application, and the ERXRoundRobinCollection contains just a couple of 
>> instances of a EOObjectStoreCoordinator at a time.
>> 
>> The ec is created with:
>> ERXEC notificationtEC = (ERXEC) 
>> ERXEC.newEditingContext(objectStoreCollection.nextObjectStoreCoordinator());
>> 
>> and the EOObjectStoreCoordinators with:
>> ERXObjectStoreCoordinator osc = new ERXObjectStoreCoordinator(true);
>> 
>> 
>> 4) I then use the newly created notificationtEC to convert the globalIds 
>> back to EOs like.. eo = 
>> ERXEOControlUtilities.convertGIDtoEO(notificationtEC, gid);
> 
> Are you locking the EC that you created?
> 

No I am not explicitly locking anything.  The app is a full blown Wonder app 
and I was under the impression that this relinquished me from having to worry 
about locking provided I was using ERXEC to create my editing contexts etc.  Is 
this not the case then?

Regards

Giles

> 
>> 
>> 5) I then use the same notificationtEC to fetch various objects etc to build 
>> the notifications and send out an email.
>> 
>> The full stack trace is below.
>> 
>> I was under the impression that having a new database stack should be a 
>> pretty safe way to do such a task in a separate thread. Do you have any idea 
>> what I am doing wrong?
>> 
>> I do not quite understand the meaning of the above 
>> java.lang.IllegalStateException   Any ideas much appreciated.
>> 
>> Thanks
>> 
>> Giles
>> 
>> Mar 18 12:32:10 OLWAInDoc[2001] pool-3-thread-1 ERROR 
>> indoc.app.event.IDEventObserverCoordinator$ChannelRunnable  - Error in 
>> ChannelRunnable.run() Cannot obtain globalId for an object which is 
>> registered in its editingContext, object: <indoc.app.entities.Container 
>> pk:"496">, databaseContext: er.extensions.eof.ERXDatabaseContext@ee260b, 
>> object's editingContext: er.extensions.eof.ERXEC@1fe6055, databaseContext's 
>> active editingContext: null
>> java.lang.IllegalStateException: Cannot obtain globalId for an object which 
>> is registered in its editingContext, object: <indoc.app.entities.Container 
>> pk:"496">, databaseContext: er.extensions.eof.ERXDatabaseContext@ee260b, 
>> object's editingContext: er.extensions.eof.ERXEC@1fe6055, databaseContext's 
>> active editingContext: null
>>      at 
>> com.webobjects.eoaccess.EODatabaseContext._globalIDForObject(EODatabaseContext.java:4660)
>>      at 
>> com.webobjects.eoaccess.EODatabaseContext.valuesForKeys(EODatabaseContext.java:6509)
>>      at 
>> com.webobjects.eocontrol.EOObjectStoreCoordinator.valuesForKeys(EOObjectStoreCoordinator.java:326)
>>      at 
>> com.webobjects.eoaccess.EOQualifierSQLGeneration$_KeyValueQualifierSupport.schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:439)
>>      at 
>> er.extensions.ERXExtensions$KeyValueQualifierSQLGenerationSupport.schemaBasedQualifierWithRootEntity(ERXExtensions.java:355)
>>      at 
>> com.webobjects.eoaccess.EOQualifierSQLGeneration$Support._schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:179)
>>      at 
>> com.webobjects.eoaccess.EOQualifierSQLGeneration$_AndQualifierSupport.schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:530)
>>      at 
>> com.webobjects.eoaccess.EOQualifierSQLGeneration$Support._schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:179)
>>      at 
>> com.webobjects.eoaccess.EOQualifierSQLGeneration$_AndQualifierSupport.schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:530)
>>      at 
>> com.webobjects.eoaccess.EOQualifierSQLGeneration$Support._schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:179)
>>      at 
>> com.webobjects.eoaccess.EOQualifierSQLGeneration$_OrQualifierSupport.schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:567)
>>      at 
>> com.webobjects.eoaccess.EOQualifierSQLGeneration$Support._schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:179)
>>      at 
>> com.webobjects.eoaccess.EODatabaseChannel.selectObjectsWithFetchSpecification(EODatabaseChannel.java:227)
>>      at 
>> com.webobjects.eoaccess.EODatabaseContext._objectsWithFetchSpecificationEditingContext(EODatabaseContext.java:3055)
>>      at 
>> er.extensions.eof.ERXDatabaseContext._objectsWithFetchSpecificationEditingContext(ERXDatabaseContext.java:66)
>>      at 
>> com.webobjects.eoaccess.EODatabaseContext.objectsWithFetchSpecification(EODatabaseContext.java:3195)
>>      at 
>> com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpecification(EOObjectStoreCoordinator.java:488)
>>      at 
>> com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4069)
>>      at 
>> er.extensions.eof.ERXEC.objectsWithFetchSpecification(ERXEC.java:1206)
>>      at 
>> com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4444)
>>      at 
>> indoc.app.entities._IDEventRegistration.fetchIDEventRegistrations(_IDEventRegistration.java:351)
>>      at 
>> indoc.app.event.IDEventObserverCoordinator$ChannelRunnable.processEventRegistrations(IDEventObserverCoordinator.java:238)
>>      at 
>> indoc.app.event.IDEventObserverCoordinator$ChannelRunnable.run(IDEventObserverCoordinator.java:143)
>>      at 
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>      at 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>      at java.lang.Thread.run(Thread.java:619)
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
>> 
>> This email sent to [email protected]
> 
> -- 
> Chuck Hill             Senior Consultant / VP Development
> 
> Practical WebObjects - for developers who want to increase their overall 
> knowledge of WebObjects or who are trying to solve specific problems.    
> http://www.global-village.net/products/practical_webobjects
> 
> 
> 
> 
> 
> 
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to