primary key trouble: IllegalArgumentException: Array is empty
primary key trouble: IllegalArgumentException: Array is empty
- Subject: primary key trouble: IllegalArgumentException: Array is empty
- From: Zak Burke <email@hidden>
- Date: Wed, 16 Feb 2005 11:32:45 -0500
I am getting an "IllegalArgumentException: Array is empty" when some
users submit a form that persists an EO to my database. The
behaviour is sporadic and random. Sometimes saving is successful;
sometimes it fails. I haven't been able to isolate any differences
in operating environments (browser, platform, version) that can
avoid or provoke this behaviour consistently so I'm at a total loss
to explain it.
Here is an abbreviated stacktrace; the full one is below:
java.lang.IllegalArgumentException: Array is empty
...foundation.NSArray.objectAtIndex(488)
...jdbcadaptor.JDBCPlugIn.newPrimaryKeys(625)
...jdbcadaptor.JDBCChannel.primaryKeysForNewRowsWithEntity(537)
...eoaccess.EODatabaseContext._batchNewPrimaryKeysWithEntity(5891)
...eoaccess.EODatabaseContext.prepareForSaveWithCoordinator(5874)
...eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(409)
...eocontrol.EOEditingContext.saveChanges(3165)
org.thei3p.eocontrol.I3pkbEditingContext.saveChanges(65)
org.thei3p.pages.news.NewsDocumentEditForm.save(92)
The relevant line in I3pkbEditingContext.saveChanges, which inherits
from EOEditingContext, is simply a call to super.saveChanges(). We
are using WO 5.2.3 on MacOS Server 10.3.7 with Apache 1.3.x and
MySQL 4.1.7.
The problem appears to be related to primary key generation but this
logic is so far abstracted from the things that vary (browser, OS,
etc.) that I'd expect it to fail in all circumstances if it was
broken at all. But this behaviour is decidedly variable. Grrrr.
The JavaDoc for com.webobjects.jdbcadaptor.JDBCPlugIn.newPrimaryKeys
states that it will return null, rather than an empty array "If the
primary key contains multiple attributes or is not of kind number".
That suggests to me that if there were problems generating my key, I
should be seeing a null pointer exception when objectAtIndex is
called on the (presumably) null array returned by newPrimaryKeys,
rather than this behaviour which suggests an array is being
instantiated but returned without elements.
EO_PK_TABLE has entries for each of the EOs accessed by this
application, and the app does work for some users. This does not
appear to be a concurrency/locking problem: the users are not in the
app at the same time.
I'm stumped and not sure how to proceed with debugging. Has anybody
else encountered this kind of behaviour?
Thanks for any tips,
zak.
Array is empty
java.lang.IllegalArgumentException: Array is empty
at com.webobjects.foundation.NSArray.objectAtIndex(NSArray.java:488)
at
com.webobjects.jdbcadaptor.JDBCPlugIn.newPrimaryKeys(JDBCPlugIn.java:625)
at
com.webobjects.jdbcadaptor.JDBCChannel.primaryKeysForNewRowsWithEntity(JDBCChannel.java:537)
at
com.webobjects.eoaccess.EODatabaseContext._batchNewPrimaryKeysWithEntity(EODatabaseContext.java:5891)
at
com.webobjects.eoaccess.EODatabaseContext.prepareForSaveWithCoordinator(EODatabaseContext.java:5874)
at
com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:409)
at
com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3165)
at
org.thei3p.eocontrol.I3pkbEditingContext.saveChanges(I3pkbEditingContext.java:65)
at
org.thei3p.pages.news.NewsDocumentEditForm.save(NewsDocumentEditForm.java:92)
at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
com.webobjects.foundation.NSKeyValueCoding$1.methodValue(NSKeyValueCoding.java:684)
at
com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.valueInObject(NSKeyValueCoding.java:1160)
at
com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.valueForKey(NSKeyValueCoding.java:1268)
at
com.webobjects.appserver.WOComponent.valueForKey(WOComponent.java:1539)
at
com.webobjects.foundation.NSKeyValueCoding$Utility.valueForKey(NSKeyValueCoding.java:498)
at
com.webobjects.foundation.NSKeyValueCodingAdditions$DefaultImplementation.valueForKeyPath(NSKeyValueCodingAdditions.java:212)
at
com.webobjects.appserver.WOComponent.valueForKeyPath(WOComponent.java:1600)
at
com.webobjects.appserver._private.WOKeyValueAssociation.valueInComponent(WOKeyValueAssociation.java:46)
at
com.webobjects.appserver._private.WOSubmitButton.invokeAction(WOSubmitButton.java:70)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:101)
at
com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:110)
at
com.webobjects.appserver._private.WOForm.invokeAction(WOForm.java:82)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:101)
at
com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:110)
at
com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:945)
at
com.webobjects.appserver._private.WOComponentReference.invokeAction(WOComponentReference.java:104)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:101)
at
com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:110)
at
com.webobjects.appserver._private.WOComponentContent.invokeAction(WOComponentContent.java:31)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:101)
at
com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:110)
at
com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:945)
at
com.webobjects.appserver._private.WOComponentReference.invokeAction(WOComponentReference.java:104)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:101)
at
com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:110)
at
com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:945)
at com.webobjects.appserver.WOSession.invokeAction(WOSession.java:1166)
at
com.webobjects.appserver.WOApplication.invokeAction(WOApplication.java:1375)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedPage(WOComponentRequestHandler.java:196)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedSession(WOComponentRequestHandler.java:287)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedApplication(WOComponentRequestHandler.java:322)
at
com.webobjects.appserver._private.WOComponentRequestHandler._handleRequest(WOComponentRequestHandler.java:358)
at
com.webobjects.appserver._private.WOComponentRequestHandler.handleRequest(WOComponentRequestHandler.java:432)
at
com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:1306)
at org.thei3p.Application.dispatchRequest(Application.java:101)
at
com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:173)
at
com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:254)
at java.lang.Thread.run(Thread.java:552)
_______________________________________________
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