Using own classloader inside J2EE to load and unload own classes.

Discussion in 'Java' started by Stefan Siegl, Sep 21, 2004.

  1. Stefan Siegl

    Stefan Siegl Guest

    Hello it's me again,

    I am currently writing my master thesis about a customer relationship
    management (CRM) system. The special thing about this component is that
    the model (the way the CRM data is described) can be changed at runtime.
    That means I do not have the model at compile time. I already posted
    here to get general hints from you guys (sry don't know how to link to
    the other news message, but the name was: Compile java sources inside
    J2EE component)

    I specified the component in more detail and am currently trying to
    integrate a persistence layer to persist data. My approach is to create
    classes at runtime that reflect the current model and use instances of
    these classes to represent data entered according to this model.

    The classes are loaded by an own classloader and are not part of the
    classpath of the J2EE container. If the model changes, new classes are
    created internally and a new classloader instance is used to load these
    classes. The old instance of my own classloader will not be used
    anymore. Therefore the old classes will not be used anymore. Is this
    possible or will I face problems with the J2EE container?


    Another question is the integration of persistence:

    What I need is a persistence framework that can deal with this changing
    of the classes at runtime. I thought that it might be possible with an
    JDO implementation. As far as i understand, the PersistenceManager is
    the central point of any JDO implementation and is responsible for
    persisting objects. I wanted to use JDO with the JCA adapter inside a
    J2EE application and provide the PersistenceManager with my own
    classloader to provide the JDO implementation with the needed classes
    that are created at runtime. The JDO specification defines that the
    class should be loaded by a classForName method. Do you think it is
    feasible (or possible) to change this method to use my own classloader
    instead?

    Thanks for your advice :)
    Stefan
    Stefan Siegl, Sep 21, 2004
    #1
    1. Advertising

  2. Stefan Siegl

    Guest

    On Tuesday, September 21, 2004 1:41:54 PM UTC+5:30, Stefan Siegl wrote:
    > Hello it's me again,
    >
    > I am currently writing my master thesis about a customer relationship
    > management (CRM) system. The special thing about this component is that
    > the model (the way the CRM data is described) can be changed at runtime.
    > That means I do not have the model at compile time. I already posted
    > here to get general hints from you guys (sry don't know how to link to
    > the other news message, but the name was: Compile java sources inside
    > J2EE component)
    >
    > I specified the component in more detail and am currently trying to
    > integrate a persistence layer to persist data. My approach is to create
    > classes at runtime that reflect the current model and use instances of
    > these classes to represent data entered according to this model.
    >
    > The classes are loaded by an own classloader and are not part of the
    > classpath of the J2EE container. If the model changes, new classes are
    > created internally and a new classloader instance is used to load these
    > classes. The old instance of my own classloader will not be used
    > anymore. Therefore the old classes will not be used anymore. Is this
    > possible or will I face problems with the J2EE container?
    >
    >
    > Another question is the integration of persistence:
    >
    > What I need is a persistence framework that can deal with this changing
    > of the classes at runtime. I thought that it might be possible with an
    > JDO implementation. As far as i understand, the PersistenceManager is
    > the central point of any JDO implementation and is responsible for
    > persisting objects. I wanted to use JDO with the JCA adapter inside a
    > J2EE application and provide the PersistenceManager with my own
    > classloader to provide the JDO implementation with the needed classes
    > that are created at runtime. The JDO specification defines that the
    > class should be loaded by a classForName method. Do you think it is
    > feasible (or possible) to change this method to use my own classloader
    > instead?
    >
    > Thanks for your advice :)
    > Stefan


    Hi Stefan,

    This is a old mail chain. I hope you have found a solution :) If so can youshare with me ? I have a similar problem to load/unload set of classes when needed in a j2ee environment. I am looking at osgi and implementing it inside the business logic. Is there any other way ?

    Thanks,
    Abhishek
    , Jul 2, 2013
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    14,197
    Madhumita
    Feb 13, 2008
  2. Matthias

    Using my own ClassLoader

    Matthias, Oct 28, 2003, in forum: Java
    Replies:
    2
    Views:
    518
    John C. Bollinger
    Oct 28, 2003
  3. Guy Robinson

    howto load and unload a module

    Guy Robinson, Jun 24, 2005, in forum: Python
    Replies:
    7
    Views:
    3,239
    Guy Robinson
    Jun 24, 2005
  4. lander
    Replies:
    5
    Views:
    2,509
    Mark Rae [MVP]
    Mar 3, 2008
  5. Zvt.Fred
    Replies:
    17
    Views:
    308
    Garrett Smith
    Apr 13, 2009
Loading...

Share This Page