AW: Classloader

From: Frédéric Dreier (frederic.dreie..ptime.ch)
Date: Wed Aug 20 2003 - 05:24:57 EDT

  • Next message: Christian Mittendorf: "Project jar file is no longer build after update?!"

    Thanks, it works!

    using getResourceAsStream instead of getSystemResourceAsStream and updating
    path to absolute path (starting with a /) both way (within eclipse and from
    command line) works :-)

    Thanks for the support,

    Frederic

    -----Ursprüngliche Nachricht-----
    Von: Chuck Hill [mailto:chil..lobal-village.net]
    Gesendet: Dienstag, 19. August 2003 19:04
    An: Frédéric Dreier; Woproject
    Betreff: Re: Classloader

    WOBootstrap is what WO 5.2 uses for launching WO Apps. You might be better
    off rewriting the code below:

    com.bar.foo.TheClass.class.getClassLoader().getResourceAsStream("mypack/file
    .xml");

    (off the top of my head). getSystemResourceAsStream()locates the resource
    through the system class loader (see getSystemClassLoader()). That is
    probably above the WOBootstrap classloader and hence the resource cannot be
    located.

    Chuck

    At 07:03 PM 19/08/2003 +0200, Frédéric Dreier wrote:
    >Hi,
    >
    >I am still trying to deploy my application and get stuck on a classloader
    >problem.. Within eclipse everything run perfectly, but I run in troubles
    >stating from command line (using myApp.cmd)..
    >
    >I have a WOApplication that use an external jar file. A class within this
    >jar file load some XML file (also in the jar file) using:
    >
    >ClassLoader.getSystemResourceAsStream("mypack/file.xml");
    >
    >It returns the stream when running within eclipse but null when running
    from
    >command line.
    >
    >After some investigations i find that the system classloader are not the
    >same. Running from command line use some kind of 'WOBootstrap'
    classloader..
    >(?)
    >
    >
    >Thanks in advance,
    >
    >
    >Frederic
    >
    >
    >
    >PS: using 'Class.forName("mypack/MyClass");' return a value, it says that
    >the jar files is in path...
    >
    >

    --
    

    Chuck Hill chil..lobal-village.net Global Village Consulting Inc. http://www.global-village.net



    This archive was generated by hypermail 2.0.0 : Wed Aug 20 2003 - 05:16:18 EDT