Re: Problems with standalone jars using EOModels and NSBundle

From: Chuck Hill (chil..lobal-village.net)
Date: Thu Feb 15 2007 - 22:29:59 EST

  • Next message: Sean: "Re: Unable to Launch WOApplication"

    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



    This archive was generated by hypermail 2.0.0 : Thu Feb 15 2007 - 22:30:28 EST