• 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
Re: Exception only when framework is embedded
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exception only when framework is embedded


  • Subject: Re: Exception only when framework is embedded
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 7 Aug 2008 20:00:49 -0700

Hi Art!


On Aug 7, 2008, at 7:06 PM, Art Isbell wrote:

Eclipse 3.3.2
WOLips 3.3.5281
Mac OS X 10.5.4
WO 5.3.3 frameworks and /Library/WebObjects/Extensions

OK, I'm at wit's end (or maybe half-wit's or dimwit's end :-)

:-P


A non-WOnder app, Waldo, depends on a non-WOnder framework, WOCommon. The WOCommon framework defines a class wocommon.Session that derives from WOSession. Waldo defines a class waldo.Session that derives from wocommon.Session.

Waldo runs without error from within Eclipse running in Web server connect mode.

Ant-built Waldo runs without error from outside Eclipse when the ant-built WOCommon framework is not embedded in Waldo. /Library/ Frameworks/WOCommon.framework is a symbolic link to <my_Eclipse_workspace_path>/WOCommon/dist/WOCommon.framework so that /Library/Frameworks/WOCommon.framework is always up-to-date with the ant-built WOCommon framework in the dist directory of my WOCommon framework project.

Ant-built Waldo throws a class cast exception when run from outside Eclipse with identical launch arguments (those configured in JavaMonitor and used when wotaskd launches the app) when the ant- built WOCommon framework is embedded in Waldo by setting the wo.wolocalroot framework "embed" property to "true". The class cast exception is thrown at this statement in Waldo's Main.java:

		final Session sessionL = (Session)session();

because session() returns a wocommon.Session but is being cast to a waldo.Session.

When the WOCommon framework isn't embedded but is otherwise identical as best I can tell, session() returns a waldo.Session. For some reason, a wocommon.Session is being created rather than a waldo.Session when the WOCommon framework is embedded. WTF?!

Indeed. I just had the opposite problem: it would not run in Eclipse and would run outside. The culprit: NSBundle(OfBugs). Embedding frameworks changes the jar load order and NSBundle resolves classes (with IIRC _NSUtilities) in the wrong order (e.g. not main bundle first). So it picks up, erm, whatever. I was getting a java.mail.Session! Mike (brave man that he is) dug into this, so I will leave it to him to say more.



I have compared the class paths in MacOSClassPath.txt and in the launch output for Waldo with and without the WOCommon framework embedded. The class paths are identical with the exception of the paths to wocommon.jar. The checksums of waldo.jar and wocommon.jar are identical in the embedded and non-embedded cases. I've run out of ideas.

I need to deploy Waldo with the WOCommon framework embedded because a different WOCommon framework version is in /Library/Frameworks on the deployment server. But I am unable to do so because of this class cast exception that has defied my ability to debug the problem for a couple of very frustrating days. Can someone please point out the error in my ways?

Alas, Art, it is not you. I don't have an easy answer to the general case of this problem. Someone on the WO team needs to fix this. IIRC, Mike submitted a bug report and a suggestion for a patch.


For this specific problem, however, there is a solution. Add this to the Application class in Waldo:

protected Class _sessionClass() {
    return waldo.Session.class;
}


Chuck


-- 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@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Exception only when framework is embedded
      • From: Art Isbell <email@hidden>
References: 
 >Exception only when framework is embedded (From: Art Isbell <email@hidden>)

  • Prev by Date: Exception only when framework is embedded
  • Next by Date: Re: Exception only when framework is embedded
  • Previous by thread: Exception only when framework is embedded
  • Next by thread: Re: Exception only when framework is embedded
  • Index(es):
    • Date
    • Thread