This make sense.
The current mechanism for loading component will only find them
outside of a bundle is the fully qualified class name is equal to the
component name. In practice this means that packages are not
supported outside of a bundle.
Your best bet is to place all you components in bundle. You can jar
the bundle and it will work fine but it must be in a bundle.
Pierre
On 7-Mar-07, at 12:01 PM, Mike Kienenberger wrote:
> Ok. The more I look at this, the more difficult it appears. As far
> as I can tell, I can only have my WoComponent classes stored in a
> bundle. Thus, I cannot have my component classes in WEB-INF/classes
> since there's no easy way to get that "inside" a bundle. The
> exception to this rule is if the component classes are in the default
> package, in which case, they can be anywhere on the classpath (which
> seems odd in itself).
>
> On 3/7/07, Mike Kienenberger <mkienen..mail.com> wrote:
>> Thanks again, Pierre. This has been a step in the right direction.
>>
>> My component-loading classpath appears to be related to the web.xml's
>> WOClasspath context-param. The odd thing is that while I can affect
>> the classpath by removing items from this list, adding items to this
>> list appear to have no effect. Apparently being in this list is
>> necessary but not sufficient to be added to the classpath.
>>
>> Ie, if I remove my <app>.jar file from this list, the application
>> won't initialize. This is true even when <app>.jar contains nothing
>> but a trivial MANIFEST.MF file.
>> ----------------
>> Manifest-Version: 1.0
>> Created-By: 1.4.2 (Sun Microsystems Inc.)
>> ----------------
>>
>> So my guess is that I need to configure my WEB-INF/classes directory
>> to be part of a bundle, perhaps by replacing the configuration in
>> <app>.woa/Info.plist.
>>
>> On 3/7/07, Mike Kienenberger <mkienen..mail.com> wrote:
>> > Thank you, Pierre.
>> >
>> > I have also come to the conclusion that it is some kind of
>> classloader
>> > or Bundle issue.
>> >
>> > It's very frustrating -- If I move my page classes from
>> > WEB-INF/classes into
>> > WEB-INF/<app>.woa/Contents/Resources/Java/<app>.jar, and exclude
>> them
>> > from my source directory, then the application finds the classes.
>> >
>> > I'm using jettylauncher from Eclipse to run the application, and
>> both
>> > locations are clearly in the classpath for the jetty container.
>> >
>> > The classpath being used by WebObjects is clearly different from
>> the
>> > one used by the container, but despite a day's worth of
>> tinkering, I
>> > haven't figured out where it's configured.
>> >
>> > The <app>.jar name appears in these locations:
>> >
>> > WEB-INF/web.xml
>> > WEB-INF/WOJ2EE.woa/Contents/Info.plist
>> > WEB-INF/WOJ2EE.woa/Contents/Windows/CLASSPTH.txt
>> > (+ mac + unix classpath files)
>> > and of course in the Eclipse .classpath file.
>> >
>> > Hopefully your advice on Bundles will point me in the right
>> direction.
>> >
>> >
>> >
>> > On 3/7/07, Pierre Frisch <pierre.frisc..pearway.com> wrote:
>> > > Hi Mike,
>> > >
>> > > I would suggest you check you resources and resources path.
>> > >
>> > > The current algorithm to load components explore all the
>> loaded bundle and
>> > > call the following method on each loaded framework:
>> > > aBundle.pathURLForResourceNamed(aResourceName, aLanguageString,
>> > > refreshProjectOnCacheMiss); // part of WODeployedBundle
>> > > Where aResourceName is "myComponent.wo" and the language goes
>> through an
>> > > iteration.
>> > >
>> > > I suspect there is some problem with your project structure
>> and I would
>> > > suggest to debug it by trying this manually. Add some debug
>> code in you
>> > > application to find what is going on.
>> > >
>> > > You can get all loaded frameworks with
>> NSBundle.frameworkBundles();
>> > > unfortunately this return NSBundle to get WODeployedBundle do
>> > > WODeployedBundle.bundleWithNSBundle(nsBundle). This will
>> > > enable you to iterate over the frameworks. Do not forget to
>> add the main
>> > > bundle NSBundle.mainBundle();
>> > >
>> > > You can see what is going on by using
>> > > WODeployedBundle._allResourceNamesWithExtension(String
>> > > extension, boolean webServerResourcesOnly) this will give you
>> a list of what
>> > > WO sees in your project.
>> > >
>> > > Pierre
>> > >
>> > >
>> > >
>> > > On 7-Mar-07, at 9:41 AM, Mike Kienenberger wrote:
>> > >
>> > > Chuck,
>> > >
>> > > Thanks for your quick response. If you don't know, then
>> probably no
>> > > one else does.
>> > >
>> > > I guess I could cheat and stick them in something harmless like
>> > > WEB-INF/classes/java/math/* for the time being.
>> > >
>> > > On 3/7/07, Chuck Hill <chil..lobal-village.net> wrote:
>> > > I don't have much to offer here. All of my components are in
>> > > packages. I rarely need to fully qualify the name (only when
>> a class
>> > > with the same name resides in different packages). My suspicion
>> > > would lie in how the app is packaged for J2EE deployment and
>> how that
>> > > interacts with resource location. On that subject I know nearly
>> > > nothing.
>> > >
>> > > Chuck
>> > >
>> > >
>> > > On Mar 7, 2007, at 9:03 AM, Mike Kienenberger wrote:
>> > >
>> > > > I hope this is an appropriate question for this list.
>> > > >
>> > > > I'm using WebObjects 5.2.4. I'm working with a project
>> originally
>> > > > developed in 5.0. I've successfully built and deployed the
>> project
>> > > > as a j2ee application. Now, I'm trying clean up the code.
>> > > > Originally everything was in the default package. I've
>> used Eclipse
>> > > > to repackage everything.
>> > > >
>> > > > For the most part, I've been successful at this task. I
>> updated the
>> > > > class entries in the entity plist files, so EOF is working
>> fine with
>> > > > the new packages.
>> > > >
>> > > > However, the page and component classes have me stumped. I've
>> > > > updated the Resources/*.api files with the fully-qualified
>> class
>> > > > names, but the application still tries reading the
>> Main.class out of
>> > > > the default package. I verified this by copying the class
>> back to the
>> > > > default package, and it was found.
>> > > >
>> > > > If I update Application.pageWithName() to fully-qualify the
>> name, then
>> > > > my pages can be found, but the components aren't.
>> > > >
>> > > > return
>> > > > super.pageWithName(fullyQualifiedPageName(pageName),
>> > > context);
>> > > >
>> > > > private String fullyQualifiedPageName(String pageName)
>> > > > {
>> > > > if (null == pageName)
>> > > > {
>> > > > pageName = "Main";
>> > > > }
>> > > > pageName = "<mypackage>." + pageName;
>> > > > return pageName;
>> > > > }
>> > > >
>> > > > By using FileMon, I can tell that the file attributes for
>> > > > Resources\Main.api are queried, but the file is never opened
>> or read.
>> > > > Resources\Main.wo\Main.html, wod, and woo are all opened and
>> read. I
>> > > > can also see that the Main.class is read before any of the
>> Main.wo
>> > > > files are opened.
>> > > >
>> > > > If I switch back to the non-fully-qualified name, FileMon
>> shows that
>> > > > the Main.class is scanned for in a great number of places in
>> > > > WEB-INF\classes, but not in my own packages:
>> > > >
>> > > > WEB-INF\classes\Main.class
>> > > > WEB-INF\classes\java\lang\Main.class
>> > > > WEB-INF\classes\com\webobjects\*
>> > > > WEB-INF\classes\java\math\Main.class
>> > > > WEB-INF\classes\org\apache\*
>> > > > and so on.
>> > > >
>> > > > This makes me think that I need to configure something to
>> tell WO what
>> > > > my packages are.
>> > > >
>> > > > I've searched through the old archives, but I haven't found
>> anything
>> > > > that seems relevent:
>> > > >
>> > > > http://objectstyle.org/woproject-old/lists/woproject-dev/
>> > > > 2004/10/0084.html
>> > > >
>> > > http://lists.apple.com/archives/webobjects-dev/2006/Sep/
>> msg00196.html
>> > > >
>> > > http://lists.apple.com/archives/webobjects-dev/2006/Sep/
>> msg00197.html
>> > > >
>> > > http://lists.apple.com/archives/webobjects-dev/2006/Sep/
>> msg00193.html
>> > > >
>> > > > I did find useful information reminding me that instance
>> variable need
>> > > > to be changed from protected to public.
>> > > >
>> > > > It also seems like this issue may have been solved for WO
>> 5.3, but
>> > > > that's not currently an option.
>> > > >
>> > >
>> > > --
>> > >
>> > > 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
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> >
>>
>
This archive was generated by hypermail 2.0.0 : Wed Mar 07 2007 - 16:37:07 EST