Call from native thread is not handled by context class loader

Discussion in 'Java' started by lavanya.msra@gmail.com, Aug 24, 2010.

  1. Guest

    Hello. I have scenario like this:
    Call from JAVA->c++ >JAVA

    When I call JAVA defined oeprations (kind of call back) from C++
    app(called by java) immediately after receiving the call from JAVA, it
    works fine.

    C++ call from JAVA initiates a chain/ stack of subsequent calls (which
    may spawn a new process/ thread), and finally a call is again made
    from last spwned process/ thread to JAVA. When we call findClass on
    env. after attaching current thread to JVM, env is not able to find
    the class.

    As per my understanding this is probably because when we call from
    native thread to JAVA, it is using system class loader to load the
    class. And system is not able to find that class, as it is not in
    classpath probably. This is fine.

    In my JAVA application I have used custom class loader to load all my
    appliction classes. And this is capable of loading class which is
    actually required when findClass is called.

    How to instruct the env/ jvm to find class using my custom class
    loader, instead of system class loader.

    I dont want to use system class loader at all.
     
    , Aug 24, 2010
    #1
    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. Daniel Bove
    Replies:
    1
    Views:
    2,418
    Daniel Bove
    Apr 26, 2004
  2. Replies:
    1
    Views:
    556
    Andrea Desole
    Dec 14, 2005
  3. Amy Matlock
    Replies:
    4
    Views:
    354
    Amy Matlock
    Nov 10, 2005
  4. Karsten Wutzke
    Replies:
    0
    Views:
    390
    Karsten Wutzke
    Jun 29, 2007
  5. bgabrhelik
    Replies:
    0
    Views:
    826
    bgabrhelik
    Sep 29, 2009
Loading...

Share This Page