Mailing List webobjects-dev@wocommunity.org Message #425
From: Aaron Rosenzweig <aaron@chatnbike.com>
Subject: Re: [WO-DEV] Maven: Properties not available until late in app startup sequence
Date: Mon, 13 Feb 2023 13:44:07 -0500
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
Hey Samuel! I was able to give it a try just now but sad news, it didn’t work :-( It was worth a shot though. 

I tried it in three ways:

1) App.finishInitialization() — it was too late. When I tried to use the page with ERAttachment it wasn’t prepending the schema to SQL. 

2) first line inside: static main() — it was too early, the call to “loadConfiguration()” had a null pointer exception. 

3) last line inside: static main() — it was too late, the lazy initializer was already called inside of ERXEntityClassDescription.registerDescription() and is stuck… so ERAttachment still doesn’t have the schema prefix. 

Thanks for thinking about it and suggesting this. It was worth a try :-)

I’m thinking ERXEntityClassDescription.registerDescription() likely needs to be less brittle about timing. 

Cheers,
— Aaron

On Feb 13, 2023, at 8:37 AM, Samuel Pelletier <samuel@samkar.com> wrote:

Hi Aaron,

I did a quick look at properties loading and I would try this before reading the property during your early initialization code:

ERXConfigurationManager.defaultManager().loadConfiguration();

I hope this will help you!

Samuel


Le 10 févr. 2023 à 09:32, Aaron Rosenzweig <aaron@chatnbike.com> a écrit :

Hi Everyone,

There is a difference in the startup processing of properties when I launch our app in Eclipse using ANT vs Maven. Anyone know why this might be?

Our properties file has defined: er.extensions.ERXClassDescription.factoryClass

Which is supposed to direct this call: ERXEntityClassDescription.registerDescription()

But when it is time to register, the following returns null: ERXProperties.stringForKey("er.extensions.ERXClassDescription.factoryClass”)

Later, such as in installPatches() or finishInitilization(), the property has a value. So the app does find the property but not in the early part when its really needed.

I have a hunch that the order of frameworks loading is brittle and causes this behavior. We have several apps which share a “core” framework which is where the Properties file is stored and makes the declaration. I think with ANT, our core framework initialized before ERExtensions and now, with Maven, the opposite is true. I don’t know this for a fact but it’s what I suspect.

If I redeclare the property in a particular apps Properties file, then ERXEntityClassDescription.registerDescription() can determine the override. It’s a temporary workaround but it means I need to duplicate all the properties that used to be in CORE by putting them into each app's properties.
#############################################################
This message is sent to you because you are subscribed to
 the mailing list <webobjects-dev@wocommunity.org>.
To unsubscribe, E-mail to: <webobjects-dev-off@wocommunity.org>
To switch to the DIGEST mode, E-mail to <webobjects-dev-digest@wocommunity.org>
To switch to the INDEX mode, E-mail to <webobjects-dev-index@wocommunity.org>
Send administrative queries to  <webobjects-dev-request@wocommunity.org>



Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster