On 2011-09-20, at 3:57 PM, Paul Hoadley wrote:

> On 21/09/2011, at 7:51 AM, Chuck Hill wrote:
> 
>>>>> I'm using the .woa directory as the bundle.
>>>> 
>>>> The .woa directory inside the source project (dist/Foo.woa)?  Or built 
>>>> someplace else?
>>> 
>>> The former.  The source project gets checked out into a Hudson workspace, 
>>> and it builds in dist/WT2.woa.  (Yes, the WO project name differs from the 
>>> Hudson project name by one character, which is why the paths I've quoted 
>>> just have "WT" in them.  In retrospect this is not ideal, but I don't 
>>> _think_ it's causing any problems.)
>> 
>> So the project is at /whatever/WT/ and built into /whatever/WT/dist/WT2.woa? 
>>  That might cause confusion.
> 
> Yeah, it's just the difference between the Hudson project name and the Ant/WO 
> project name.  I can try making them the same if I don't get anywhere.

I don't think that is the problem, but it could be.


>> Are the frameworks embedded in that bundle?
> 
> Yes.

You could try loading them from there instead.  Just grab all the paths to jar 
files under Contents/Frameworks.


>> I am trying to work out how NSBundle is not seeing these.  There are some 
>> Funky Things (tm) in Eclipse to detect bundles that don't happen when run 
>> from the comment line.
> 
> Yeah.  I wish I knew what they were.

Nothing that will help you in Ant.


>>>>> I call junit like this:
>>>>> 
>>>>>           <junit haltonfailure="false"
>>>>>                      fork="true"
>>>>>                      dir="${dest.dir}/${project.name}.woa"
>>>>>                      printsummary="true"
>>>>>                      failureproperty="test.failed">
>>>>>                   <classpath refid="testing.classpath" />
>>>>>                   <classpath>
>>>>>                           <pathelement location="bin" />
>>>> 
>>>> What is that for?  Those are the compiled classes in the app?
>>> 
>>> Exactly.  Does that not need to be there?
>> 
>> I think this might make main bundle identification hard.  Though that does 
>> not seem to be the issue.
> 
>> I'd use
>>                              <pathelement 
>> location="${dest.dir}/${project.name}.woa/Contents/Resources/Java/${project.name}.jar"
>>  />
>> 
>> (or is that ${project.name.lowercase}.jar ?)
> 
> That also works, though didn't help finding the Local bundles.
> 
>>>> Try adding
>>>> <pathconvert property="junit.testing.classpath" refid="testing.classpath"/>
>>>> <echo> testing.classpath is  ${testing.classpath} />
>>>> 
>>>> And see if the result is what you expect.
>>> 
>>> Did you mean ${junit.testing.classpath}?
>> 
>> er, yes.  That one.
>> 
>> 
>>> Yes, it's exactly what I would expect: all of the frameworks, including 
>>> JavaMemoryAdapter.framework/Resources/Java/JavaMemoryAdaptor.jar.
>> 
>> Relative or absolute paths?
> 
> Sorry, absolute.
> 
>>> They're also all on the classpath for the JVM that's launching the JUnit 
>>> tests, so that all seems to be working.  
>> 
>> Well, you are forking the JVM for junit.
>> 
>>> The only place they're _not_ is wherever they need to be to get NSBundle to 
>>> load them.  I remain stumped.
>> 
>> Try getting the classloader in one of your tests and print out the classpath 
>> that it really is using.
> 
> It's as expected, including:
> 
> /Users/paulh/tmp/WT/workspace/Root/Library/Frameworks/JavaMemoryAdaptor.framework/Resources/Java/JavaMemoryAdaptor.jar

What if you change this code:

private void fixJavaMemoryDictionary() {
        NSBundle bundle = NSBundle.bundleForName("JavaMemoryAdaptor");
        
bundle._infoDictionary().takeValueForKey(ERMemoryAdaptor.class.getName(), 
"EOAdaptorClassName");
}

to this:
private void fixJavaMemoryDictionary() {
        NSBundle bundle = NSBundle.bundleForClass(ERMemoryAdaptor.class);
        
bundle._infoDictionary().takeValueForKey(ERMemoryAdaptor.class.getName(), 
"EOAdaptorClassName");
}


e.g. can it find it by class?


-- 
Chuck Hill             Senior Consultant / VP Development

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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to