Re: Problems with standalone jars using EOModels and NSBundle

From: Chuck Hill (chil..lobal-village.net)
Date: Fri Feb 16 2007 - 13:46:36 EST

  • Next message: sean71..mail.com: "Re: Unable to Launch WOApplication"

    Take a look at the jars in /Library/WebObjects/lib. These are the WO
    frameworks packaged as single jars. I don't know if WOLips has
    something to do this packaging or not.

    Chuck

    On Feb 15, 2007, at 10:16 PM, Joshua Archer wrote:

    > ...admittedly I'm kinda stupid when it comes to constructing jars
    > -- if I were to just create a normal jar of my app, how would I
    > have to craft it so it picks up all the other jars and libraries,
    > etc. that I need as well? I've tried adding everything to the -
    > classpath argument, but that doesn't seem to work for me.
    >
    > On Feb 15, 2007, at 7:29 PM, Chuck Hill wrote:
    >
    >> I suspect the problem is the structure of your jar. It is not
    >> throwing an exception on loading a class, it is throwing it on
    >> loading bundle resources. As a start, I'd guess that fat jars and
    >> NSBundle are not compatible. If you need the one jar thing, you
    >> are probably going to have to write a replacement for NSBundle.
    >>
    >> Chuck
    >>
    >>
    >>
    >> On Feb 15, 2007, at 5:23 PM, Joshua Archer wrote:
    >>
    >>> hey everyone,
    >>>
    >>> I've done some searching on the archives, google, etc to try and
    >>> find an answer to this problem, but I'm not getting what I'm
    >>> after. I thought I'd throw this to the group and see what you
    >>> think (or point me to the right archive and tell me to shut up :) ).
    >>>
    >>> I've created a command line java application that makes use of a
    >>> couple of frameworks that access a few EOModels that I use in my
    >>> main WO app, for the purposes of initializing data in the
    >>> database, creating admin accounts, etc. I've built it in Eclipse,
    >>> and as long as I run in eclipse, all is fine with the world.
    >>> However, when I try to compile the app as a jar and run it, I get
    >>> NSBundle initialization errors:
    >>>
    >>> tintangel:~/Development jarcher$ java -jar
    >>> PachydermAccountGenerator.jar
    >>> Exception in thread "main" java.lang.ExceptionInInitializerError
    >>> at org.pachyderm.PachydermAccountGenerator.main
    >>> (PachydermAccountGenerator.java:65)
    >>> Caused by: java.lang.NullPointerException
    >>> at
    >>> com.webobjects.foundation.NSBundle.LoadUserAndBundleProperties
    >>> (NSBundle.java:640)
    >>> at com.webobjects.foundation.NSBundle.<clinit>
    >>> (NSBundle.java:367)
    >>> ... 1 more
    >>>
    >>> I've put in lines to the code to show the current bundle info
    >>> right up front in the main method, but I think the problem is
    >>> that NSBundle won't even initialize when the class is loaded.
    >>>
    >>> Here's part of the main method:
    >>>
    >>> public static void main(String[] args) {
    >>>
    >>> System.out.println("Main.main: main bundle = " +
    >>> NSBundle.mainBundle());
    >>> System.out.println("Main.main: JavaFoundation bundle = " +
    >>> NSBundle.bundleForName("JavaFoundation"));
    >>> ....
    >>>
    >>> }
    >>>
    >>> And I've included all the jars locally using fat jar, so the
    >>> classes are in the path and available (if not, I'd be seeing
    >>> class not defined exceptions).
    >>>
    >>> Any clue how to get this to work? Are there system variables I
    >>> need to set?
    >>>
    >>> ----------------------------------------------------------------
    >>> Joshua Archer
    >>> Software Engineer
    >>> CSU - Center for Distributed Learning
    >>> Phone: 707.664.2085
    >>> Fax: 707.664.4350
    >>>
    >>>
    >>
    >> --
    >>
    >> 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
    >>
    >>
    >>
    >>
    >>
    >>
    >
    > ----------------------------------------------------------------------
    > -------
    > Joshua Archer
    > Software Engineer, CSU - Center for Distributed Learning
    > Phone: 707.664.2085, Fax: 707.664.4350
    > ----------------------------------------------------------------------
    > -------
    >
    >
    >
    >

    -- 
    

    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 : Fri Feb 16 2007 - 13:46:52 EST