Re: Getting EOGenericRecord when I don't want it...
Re: Getting EOGenericRecord when I don't want it...
- Subject: Re: Getting EOGenericRecord when I don't want it...
- From: Chuck Hill <email@hidden>
- Date: Wed, 5 Dec 2007 14:55:04 -0800
On Dec 5, 2007, at 2:50 PM, Pierce T. Wetter III wrote:
I'd guess that it is a problem with NSBundle finding the classes
in it. Try logging out the various things that NSBundle will tell
you. And do that before the above code and see if just calling
those methods makes a difference. Calling NSBundle.mainBundle()
might be enough. I recall having to call NSBundle.allBundles() in
some long ago version before that method was deprecated.
Yeah, I'm already calling and logging those results based on code
you posted:
NSLog.out.appendln("Main bundle " + NSBundle.mainBundle().toString());
NSLog.out.appendln("frameworkBundles " + NSBundle.frameworkBundles
().valueForKey("name"));
NSLog.out.appendln("frameworkBundle paths " +
NSBundle.frameworkBundles());
NSLog.out.appendln("Loaded models " + EOModelGroup.defaultGroup
().modelNames());
And the values look reasonable. I did play with the classpath such
that the framework(s) I'm trying to debug/test loaded first, but
that didn't help.
Its very weird that my local code can find the classes but
_NSUtilties._classWithFullySpecifiedName(uent.className()) can't
because they both end up calling java.lang.Class.forName(Class.java):
public static Class _classWithFullySpecifiedName(String className)
{
/* <-MISALIGNED-> */ /* 200*/ Throwable throwable = null;
/* <-MISALIGNED-> */ /* 203*/ try
{
/* <-MISALIGNED-> */ /* 203*/ Class result =
Class.forName(className);
/* <-MISALIGNED-> */ /* 204*/
_classesByPartialName.setObjectForKey(result, className);
/* <-MISALIGNED-> */ /* 205*/ return result;
So the only thing I can think is that its running into some
security issue via java.security.AccessController where it can't
make the class from inside WebObjects.
In desperation, you could try WOApplication.primeApplication()
That didn't work either (sigh).
That just calls NSBundle.mainBundle():
public static void primeApplication(String s, String s1)
{
/* <-MISALIGNED-> */ /* 384*/ if(_WOApp == null)
{
/* <-MISALIGNED-> */ /* 385*/ NSBundle nsbundle = null;
/* <-MISALIGNED-> */ /* 387*/ if(s != null)
/* <-MISALIGNED-> */ /* 388*/ nsbundle =
NSBundle.bundleWithPath(s);
/* <-MISALIGNED-> */ /* 390*/ if(nsbundle == null)
/* <-MISALIGNED-> */ /* 391*/ nsbundle =
NSBundle.bundleForName("JavaWebObjects.framework");
/* <-MISALIGNED-> */ /* 393*/ NSBundle._setMainBundle
(nsbundle);
/* <-MISALIGNED-> */ /* 396*/ String s2 =
NSProperties.getProperty(WOProperties._ApplicationNameKey);
/* <-MISALIGNED-> */ /* 397*/ if(s2 == null)
/* <-MISALIGNED-> */ /* 398*/ s2 =
NSBundle.mainBundle().name();
Hmmmm... This is interesting. This code:
NSLog.out.appendln("Verified class " + Class.forName(uent.className
()));
NSLog.out.appendln("Verified2 class " +
uent._concreteClassForDeferredFault());
NSLog.out.appendln("My class loader " + this.getClass
().getClassLoader());
NSLog.out.appendln("NSUtilities loader " +
_NSUtilities._CLASS.getClassLoader());
outputs this:
Verified class class com.paceap.businesslogic.server.User
[2007-12-05 15:48:22 MST] <main> Class
'com.paceap.businesslogic.server.User' not found for Entity 'User',
using EOGenericRecord instead
Verified2 class class com.webobjects.eocontrol.EOGenericRecord
My class loader sun.misc.Launcher$AppClassLoader@e39a3e
NSUtilities loader sun.misc.Launcher$ExtClassLoader@98dfaf
So NSUtilities is using sun.misc.Launcher$ExtClassLoader instead of
sun.misc.Launcher$AppClassLoader.
Now how to I fix that I wonder...
That would be the Java Extensions class loader, I think. Do you have
TestNG or something else that might be affecting this in /Library/
Java/Extensions?
Chuck
--
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