Re: Object not registered in any editingContext?
Re: Object not registered in any editingContext?
- Subject: Re: Object not registered in any editingContext?
- From: Chuck Hill <email@hidden>
- Date: Mon, 27 Mar 2006 16:22:37 -0800
Hi Ian,
On Mar 27, 2006, at 2:41 PM, Ian Joyner wrote:
(Sorry if this is a repost, but it has not turned up in my inbox
from last night.)
The list has been a bit unstable the last few days. I was getting
bounces at one point that said email@hidden was an
unknown mailbox.
I'm intermittently getting the error:
"Cannot obtain globalId for an object which is not registered in
any editingContext"
I see quite a few have run into this one over the years and have
read all those posts. I'm using Java client, so the error is
happening on the server and being reported back to the client.
For me, this does not happen when I build and run the project from
Xcode and if I build deployment and run the app, it only happens
50% of the time. Here is the output I am getting from inserting a
simple Person object:
[2006-03-27 16:25:13 EST] <AWT-EventQueue-0>
CronusIII.client.Person_interface_controller save editing context
com.webobjects.eocontrol.EOEditingContext@a88c32
[2006-03-27 16:25:13 EST] <AWT-EventQueue-0>
CronusIII.client.Person_interface_controller save inserted ({values
= {gender = "<com.webobjects.eocontrol.EOGenericRecord 1a30e7
_EOIntegralKeyGlobalID[Gender (java.lang.Integer)6]>"; skills = ();
date_of_birth = <com.webobjects.foundation.NSKeyValueCoding$Null>;
termination_date = <com.webobjects.foundation.NSKeyValueCoding
$Null>; creation_date = 2006-03-27 06:25:00 Etc/GMT; alias =
<com.webobjects.foundation.NSKeyValueCoding$Null>; contacts = ();
first_name = "Aadf"; title =
"<com.webobjects.eocontrol.EOGenericRecord 809883
_EOIntegralKeyGlobalID[Title (java.lang.Integer)1]>"; surname =
"Aadf"; middle_names = <com.webobjects.foundation.NSKeyValueCoding
$Null>; notes = (); addresses = (); person_type = "null"; unique_id
= <com.webobjects.foundation.NSKeyValueCoding$Null>; custom_data =
(); telephones = (); attachments = (); modification_date =
2006-03-27 06:25:00 Etc/GMT; is_a_doctor = "F"; is_a_manager = "F";
images = (); type = "P"; email_addresses = (); }; this =
"<com.sportstec.generic.client.Person c6395b <EOTemporaryGlobalID:
0 0 -64 -88 0 7 1 0 7 -47 1 0 0 0 1 10 58 96 115 -91 -54 29 -68
-51>>"; })
[2006-03-27 16:25:13 EST] <AWT-EventQueue-0>
CronusIII.client.Person_interface_controller save updated ()
[2006-03-27 16:25:13 EST] <AWT-EventQueue-0>
CronusIII.client.Person_interface_controller save deleted ()
[2006-03-27 16:25:13 EST] <AWT-EventQueue-0>
CronusIII.client.Person_interface_controller Cannot null Server
exception: Cannot obtain globalId for an object which is not
registered in any editingContext, object:
<com.webobjects.eocontrol.EOGenericRecord 88d364 (EOEditingContext
$_EOInvalidFaultHandler aa711)>, databaseContext:
com.webobjects.eoaccess.EODatabaseContext@fceb09, object's
editingContext: null, databaseContext's active editingContext:
com.webobjects.eocontrol.EOEditingContext@989e7c
That looks like something is messaging an EO that was in an editing
context which has been finalized.
Which shows the current ec, its inserted object and no deleted or
updated objects. The ec of the bad object is indeed null (which is
different to most posts). And I'm not using nested contexts. The
offending object is an EOGenericRecord, which means it must be
either the persons title (mr, mrs, etc) or gender (male, female),
however, its address does not match those fields in the person
record. The offending EOGenericRecord also has an ec of null.
It wouldn't, it is from a different EC. It is also possible that is
it not really generic record, but rather that EOF has lost track of
what it used to be.
Here is related save code:
public boolean save () {
Service.log (this, " save editing context "+editingContext ());
Service.log (this, " save inserted "+editingContext
().insertedObjects());
Service.log (this, " save updated "+editingContext
().updatedObjects());
Service.log (this, " save deleted "+editingContext
().deletedObjects());
boolean result = super.save ();
NSNotificationCenter.defaultCenter ().postNotification
("update_contacts", null);
Could this be cause of the problem? What is receiving this
notification? Is it possible that is it trying to operate on on old
EOs from an EC that has been finalized? Does something need to un-
register from this notification.
return result;
}
and super.save:
public boolean save () {
// Service.log (this, " saving "+state);
if (editingContext ().hasChanges ()) {
try {
editingContext ().saveChanges ();
end_operation ();
} catch (Exception x) {
Service.log (this, " Cannot " + operation + " " + x.getMessage
());
Looks like this is where the error is getting logged so it seems that
the postNotification above is not the cause. Though it may be some
other notification that is getting posted. It might be worth
registering an omniscient observer around this operation and logging
out all the notifications that saveChanges() results in.
String last_operation = operation;
// Service.log (this, " saving 2 "+state);
if (state == deleting) revert (); // must do before
runErrorDialog ... seems to be a bug (in EODocumentController.save
()) if deleted object is last in table.
EODialogs.runErrorDialog ("Cannot " + last_operation, "Cannot "
+ last_operation + (last_object_id != null? (" '" + last_object_id
+ "'"): "") + ".\n\n" + x.getMessage () + ".");
return false;
}
}
return true;
}
Could there be any deployment settings that are causing this, since
it does not happen with the development build?
None that I can think of. If it is garbage collection related, it
could be related to heap size, version differences, etc.
Chuck
--
Coming in 2006 - an introduction to web applications using WebObjects
and Xcode http://www.global-village.net/wointro
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden