• 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: Application Startup...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Application Startup...


  • Subject: RE: Application Startup...
  • From: "Colin Shreffler" <email@hidden>
  • Date: Fri, 27 Jan 2006 16:55:56 -0700

I am developing on OS X using Eclipse.  Nothing out of the ordinary.

 

This line of code:

Application app = (Application) this.application();

Is throwing an ‘Invalid cast exception’.  Yet both classes inherit from WOApplication.  I, too, am confused as to why this wouldn’t work.  I even tried stripping the Application class entirely of its functionality, but still got the same Exception.

 

Do you think the exception has anything to do with the Application instance being a singleton?  Just a thought.  The cast creates a reference, so I can’t imagine why it would throw an exception.

 

Thanks,
Colin

 


From: Jerry W. Walker [mailto:email@hidden]
Sent: Friday, January 27, 2006 4:25 PM
To: Colin Shreffler
Cc: email@hidden
Subject: Re: Application Startup...

 

Hi, Colin,

 

On Jan 27, 2006, at 5:33 PM, Colin Shreffler wrote:



In my wo application, I have a class that was created by the development environment (when the project was created) called Application.java.

 

This is the standard Application class provided by WO to allow you to override WOApplication, a singleton class whose single instance represents the application.



I am trying to add a start up routine to my application (to read information in a Properties file) and thought that the best place to put this would be in the constructor of this class. 

 

It does not, however, appear to be working…  the constructor doesn’t appear to get called.  Is there a better way to add start up routines?  In a different class perhaps?

 

This is the appropriate place to add initialization code if you're running a standard WO deployment. I haven't deployed outside that environment, but I seem to remember reading on the list that a WOApp is initialized slightly differently if deployed in a J2EE servlet container. In any case, it would help to know what your deployment environment is if you're having this kind of trouble.



I’m not sure if this is the class that is used to create the ‘actual’ application instance when the wo application starts up.  It does also inherit from WOApplication.

 

As stated above, this is the class provided to you to customize (by inheritance) the WOApplication class which represents the application. Within any given WO application, this is a singleton class. You can run multiple WO instances on a server, but communicating between them requires going outside the bounds of the application.                       



Further more, when I try the following cast in my code it fails:

 

Application app = (Application) this.application();

 

The instanced referenced by this.application() also inherits from WOApplication.  Why won’t this cast work?

 

I don't know why this should fail. Could you provide more information on how it fails?



Any help on this matter would be greatly appreciated.

Please post answers to these questions back to the mailing list for a wider audience to address further concerns, and so both current mailing list members and posterity can follow the thread if others have the same problems.

 

Regards,

Jerry

 

--

__ Jerry W. Walker,

   WebObjects Developer/Instructor for High Performance Industrial Strength Internet Enabled Systems

 

    email@hidden

    203 278-4085        office

 



 

 _______________________________________________
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: Application Startup...
      • From: Mike Schrag <email@hidden>
References: 
 >Re: Application Startup... (From: "Jerry W. Walker" <email@hidden>)

  • Prev by Date: Re: why is Main being called again?
  • Next by Date: Re: Implementing an ordered tree
  • Previous by thread: Re: Application Startup...
  • Next by thread: Re: Application Startup...
  • Index(es):
    • Date
    • Thread