Call from native thread is not handled by context class loader

L

lavanya.msra

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top