Re: Application Startup...
Re: Application Startup...
- Subject: Re: Application Startup...
- From: Colin Shreffler <email@hidden>
- Date: Fri, 27 Jan 2006 21:52:23 -0700
- Thread-topic: Application Startup...
Title: Re: Application Startup...
I discovered the problem.
I am using Eclipse to develop my application. In the Run properties dialog the ‘Main class’ we set to WOApplication. I changed this to point to my Application class and everything worked as expected.
Thanks to all of you for your suggestions.
Colin
On 1/27/06 5:18 PM, "Jerry W. Walker" <email@hidden> wrote:
Hi, Colin,
The question I asked was how are you DEPLOYING, not how are you IMPLEMENTING. However, the question may be irrelevant. The reason you're getting an error with this line of code:
Application app = (Application) this.application();
is because the method application() is a WOApplication static method and can't be referenced through your instance. So leave the "this" off to make it:
Application app = (Application)application();
or, to be even safer, use:
Application app = (Application)WOApplication.application();
Sorry, it's Friday night and I'm tired. :-)
Regards,
Jerry
On Jan 27, 2006, at 6:55 PM, Colin Shreffler wrote:
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
--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial Strength Internet Enabled Systems
email@hidden
203 278-4085 office
Thank you,
Colin Shreffler
Principal
303.349.9010 - cell
email@hidden
Warp 9 Software, LLC.
6791 Halifax Avenue
Castle Rock, CO 80104
Confidentiality Notice: The information in this e-mail may be confidential
and/or privileged. This e-mail is intended to be reviewed by only the
individual or organization named in the e-mail address. If you are not the
intended recipient, you are hereby notified that any review, dissemination
or copying of this e-mail and attachments, if any, or the information
contained herein, is strictly prohibited.
_______________________________________________
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