• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
ClassCastException com.webobjects.eocontrol._EOWeakReference
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ClassCastException com.webobjects.eocontrol._EOWeakReference


  • Subject: ClassCastException com.webobjects.eocontrol._EOWeakReference
  • From: Brendan Duddridge <email@hidden>
  • Date: Tue, 21 Jun 2005 17:12:11 -0600

Hi,

We're encountering an odd exception in our code when relating an object that's in an EOSharedEditingContext to an object that is in a regular EOEditingContext.

Here's the code we're using:

public static void createClickHistory(EOEditingContext ec, String ipAddress, String userAgent, Category category) {
    CategoryClickHistory newHistory = (CategoryClickHistory) EOUtilities.createAndInsertInstance(ec, "SSCategoryClickHistory");
    newHistory.setCategory((Category) EOUtilities.localInstanceOfObject(ec, category));
    newHistory.setDateClicked(new NSTimestamp());
    newHistory.setUserAgent(userAgent);
    newHistory.setIpAddress(ipAddress);
    try {
        ec.saveChanges();
        category.updateClickCount();
    } catch (Exception e) {
        // Can't save history for some reason. Just dump for now.
        e.printStackTrace();
    }
}

Things to note:
    1. Category is in the EOSharedEditingContext
    2. EOEditingContext is created, locked, and unlocked after usage in the performActionNamed() method of DirectAction.
    3. Our EOEditingContext is created and stored in a ThreadLocal and we retrieve it when needed.
    4. Our app is multi-threaded (ie. WOAllowsConcurrentRequestHandling = true).

and here's the exception thrown:


java.lang.ClassCastException: com.webobjects.eocontrol._EOWeakReference
        at com.webobjects.eocontrol.EOEditingContext._eoForGID(EOEditingContext.java:2583)
        at com.webobjects.eocontrol.EOEditingContext._localObjectForGlobalID(EOEditingContext.java:2640)
        at com.webobjects.eocontrol.EOEditingContext._processInitializedObjectsInSharedContext(EOEditingContext.java:2544)
        at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at com.webobjects.foundation.NSSelector.invoke(NSSelector.java:354)
        at com.webobjects.foundation.NSSelector._safeInvokeSelector(NSSelector.java:108)
        at com.webobjects.eocontrol.EOEditingContext._sendOrEnqueueNotification(EOEditingContext.java:4724)
        at com.webobjects.eocontrol.EOEditingContext._objectsInitializedInSharedContext(EOEditingContext.java:2533)
        at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at com.webobjects.foundation.NSSelector._safeInvokeMethod(NSSelector.java:120)
        at com.webobjects.foundation.NSNotificationCenter$_Entry.invokeMethod(NSNotificationCenter.java:598)
        at com.webobjects.foundation.NSNotificationCenter.postNotification(NSNotificationCenter.java:542)
        at com.webobjects.foundation.NSNotificationCenter.postNotification(NSNotificationCenter.java:572)
        at com.webobjects.eocontrol.EOSharedEditingContext._processRecentChanges(EOSharedEditingContext.java:542)
        at com.webobjects.eocontrol.EOEditingContext.processRecentChanges(EOEditingContext.java:1890)
        at com.webobjects.eocontrol.EOSharedEditingContext.unlock(EOSharedEditingContext.java:742)
        at com.webobjects.eocontrol.EOEditingContext.unlockObjectStore(EOEditingContext.java:4695)
        at com.webobjects.eocontrol.EOEditingContext.objectWillChange(EOEditingContext.java:2769)
        at com.webobjects.eocontrol.EOObserverCenter.notifyObserversObjectWillChange(EOObserverCenter.java:433)
        at com.webobjects.eocontrol.EOCustomObject.willChange(EOCustomObject.java:271)
        at com.webobjects.eocontrol._EOMutableKnownKeyDictionary$Initializer$_GenericRecordBinding.setValueInObject(_EOMutableKnownKeyDictionary.java:527)
        at com.webobjects.eocontrol.EOCustomObject.takeStoredValueForKey(EOCustomObject.java:1778)
        at ca.shopshop.ssmodel._CategoryClickHistory.setCategory(_CategoryClickHistory.java:62)
        at ca.shopshop.ssmodel.CategoryManager.createClickHistory(CategoryManager.java:44)
        at DirectAction.categoryAction(DirectAction.java:40)
        at sun.reflect.GeneratedMethodAccessor273.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at com.webobjects.appserver.WODirectAction.performActionNamed(WODirectAction.java:128)
        at ca.shopshop.sscommon.SSDirectAction.performActionNamed(SSDirectAction.java:71)
        at com.webobjects.appserver._private.WOActionRequestHandler._handleRequest(WOActionRequestHandler.java:240)
        at com.webobjects.appserver._private.WOActionRequestHandler.handleRequest(WOActionRequestHandler.java:145)
        at com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:1306)
        at ca.shopshop.sscommon.SSApplication.dispatchRequest(SSApplication.java:229)
        at Application.dispatchRequest(Application.java:40)
        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)



Any Ideas? This is a tough one.


Thanks,

____________________________________________________________________
Brendan Duddridge | CTO | 403-277-5591 x24 |  email@hidden

ClickSpace Interactive Inc.
Suite L100, 239 - 10th Ave. SE
Calgary, AB  T2G 0V9

http://www.clickspace.com 
 _______________________________________________
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

  • Follow-Ups:
    • Re: ClassCastException com.webobjects.eocontrol._EOWeakReference
      • From: Art Isbell <email@hidden>
  • Prev by Date: Re: WebOjects 5.3 shows version 5.2
  • Next by Date: Re: GhostWriting (?)
  • Previous by thread: Re: WebOjects 5.3 shows version 5.2
  • Next by thread: Re: ClassCastException com.webobjects.eocontrol._EOWeakReference
  • Index(es):
    • Date
    • Thread