Re: Moving pages/components out of default packages for WebObjects 5.2.4

From: Pierre Frisch (pierre.frisc..pearway.com)
Date: Wed Mar 07 2007 - 13:37:51 EST

  • Next message: Mike Kienenberger: "Re: Moving pages/components out of default packages for WebObjects 5.2.4"

    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 - 13:39:09 EST