Re: ERXModelGroup(EOModelGroup).fetchSpecificationNamed(String, String)

Anders Peterson <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Organization Optimatika
Message-ID <[email protected]>
Yes,

I had EO classes containing this:

private static SystemCommunicator COMMUNICATOR = new SystemCommunicator();

The SystemCommunicator accessed the database, using other EO classes, to 
resolve parameters it needed to configure itself (it does not in anyway 
contain/store EOs).

...and I forgot to tell that I also updated WO from 5.2.4 to 5.3.x. I'd 
say that's when my luck changed.

Thanks, /Anders

Anjo Krank wrote:
> Code would have been better but anyway: it's a very bad idea to have 
> model-accessing code in static inits (or code that is called from 
> static inits). My guess is that previously, your prototype model was 
> loaded before the main model and now isn't. If they are both in the 
> same framework then this was pur luck on your part.
>
> You should move the code from the static init to a 
> appDidFinishLaunching notification listener.
>
> Cheers, Anjo
>
> Am 25.10.2006 um 19:49 schrieb Anders Peterson:
>
>> Thanks for trying to help,
>>
>> Setting an exception breakpoint with ExceptionInInitializerError does 
>> not work. I get a NullPointerException and then the program 
>> terminates. If I set the breakpoint with a NullPointerException I get 
>> the stack trace below (copied from the eclipse debugger).
>>
>> The stack trace that is written to the console looks slightly 
>> different (what I posted before). That's where you see the 
>> ExceptionInInitializerError.
>>
>> Actually I don't understand this. I have already concluded that the 
>> real problem must occur before this point. As I said earlier 
>> something goes wrong when I call "new EOMOdel(url)" with the url to 
>> the QsdCoreData eomodel. I get the NullPointerException later when I 
>> try to access a fetch specification in an entity that's in the 
>> eomodel that failed to initialize (and therefore is not in the 
>> EOModelGroup).
>>
>> I've attached the launch configuration classpath as an tiff-file 
>> (hope that's ok).
>>
>> /Anders
>>
>> Thread [main] (Suspended (exception NullPointerException))   
>>     ERXModelGroup(EOModelGroup).fetchSpecificationNamed(String, 
>> String) line: 597   
>>     EOUtilities.objectsWithFetchSpecificationAndBindings(EOEditingContext, 
>> String, String, NSDictionary) line: 113   
>>     QCDRemoteServer.fetchInstance(EOEditingContext, NSDictionary) 
>> line: 319   
>>     SystemCommunicator(SuperCommunicator).<init>(EOEditingContext) 
>> line: 27   
>>     SystemCommunicator(SuperCommunicator).<init>() line: 23   
>>     SystemCommunicator.<init>() line: 37   
>>     QCDProfile.<clinit>() line: 678   
>>     Class<T>.forName0(String, boolean, ClassLoader) line: not 
>> available [native method]   
>>     Class<T>.forName(String) line: 164   
>>     _NSUtilities._classWithPartialName(String, boolean) line: 307   
>>     _NSUtilities.classWithName(String) line: 291   
>>     EOModel._setEntityForEntityNameClassName(Object, String, String) 
>> line: 1242   
>>     EOModel._addFakeEntityWithPropertyList(NSDictionary) line: 1280   
>>     EOModel._initWithTableOfContentsPropertyListPathURL(NSDictionary, 
>> URL) line: 1092   
>>     EOModel.<init>(URL) line: 802   
>>     ERXModelGroup.addModelWithPathURL(URL) line: 305   
>>     ERXModelGroup.loadModelsFromLoadedBundles() line: 108   
>>     ERXExtensions.defaultModelGroup() line: 82   
>>     NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: 
>> not available [native method]   
>>     NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39   
>>     DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25   
>>     Method.invoke(Object, Object...) line: 585   
>>     NSSelector._safeInvokeMethod(Method, Object, Object[]) line: 120   
>>     _NSDelegate._perform(String, Object[]) line: 225   
>>     _NSDelegate.perform(String) line: 158   
>>     EOModelGroup.defaultGroup() line: 365   
>>     EOModelGroup.modelGroupForObjectStoreCoordinator(EOObjectStoreCoordinator) 
>> line: 887   
>>     EOUtilities.modelGroup(EOEditingContext) line: 1007   
>>     EOUtilities.objectsWithFetchSpecificationAndBindings(EOEditingContext, 
>> String, String, NSDictionary) line: 112   
>>     QCDRemoteServer.fetchInstance(EOEditingContext, NSDictionary) 
>> line: 319   
>>     SystemCommunicator(SuperCommunicator).<init>(EOEditingContext) 
>> line: 27   
>>     SystemCommunicator(SuperCommunicator).<init>() line: 23   
>>     SystemCommunicator.<init>() line: 37   
>>     Application.<init>() line: 43   
>>     NativeConstructorAccessorImpl.newInstance0(Constructor, Object[]) 
>> line: not available [native method]   
>>     NativeConstructorAccessorImpl.newInstance(Object[]) line: 39   
>>     DelegatingConstructorAccessorImpl.newInstance(Object[]) line: 27   
>>     Constructor<T>.newInstance(Object...) line: 494   
>>     Class<T>.newInstance0() line: 350   
>>     Class<T>.newInstance() line: 303   
>>     WOApplication.main(String[], Class) line: 323   
>>     ERXApplication.main(String[], Class) line: 98   
>>     Application.main(String[]) line: 24   
>>
>> --http://ojalgo.org/
>>
>> Mathematics, Linear Algebra and Optimisation with Java
>> <classpath.tiff>
>


-- 
http://ojalgo.org/

Mathematics, Linear Algebra and Optimisation with Java
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.