Problems with standalone jars using EOModels and NSBundle

From: Joshua Archer (joshu..dl.edu)
Date: Thu Feb 15 2007 - 20:23:24 EST

  • Next message: Chuck Hill: "Re: Problems with standalone jars using EOModels and NSBundle"

    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



    This archive was generated by hypermail 2.0.0 : Thu Feb 15 2007 - 20:23:47 EST