classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Asking our experts on class loading.


From: Meskauskas Audrius
Subject: Asking our experts on class loading.
Date: Thu, 13 Oct 2005 11:22:09 +0200
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Hello,

In the OMG specification there are several places where the user application passes a class name to the core class library and the method inside the core must find and load the user class having this name only.

Class.forName(String) uses classloader that loaded the current class. Inside the core it is a system class loader, so there is no use of it because the user class is not a part of the core library.

Using thread context class loader seems better, because it is the loader that loaded the application. With this loader, typical application finds the classes, and it is how our CORBA is currently implemented. The problem is, even context class loader may not find a class if part of the user application was loaded separately.

This was happening in Mauve tests, where I was observing unexpected failures. The default thread context class loader is the loader that was used to start the Ant application. Ant loads the Mauve test with its own different loader. Then Mauve test classes are not found by the context class loader. If the Mauve test calls the core library, the library seems having no way to locate the caller class.

To work around the problem, I modified the problematic tests by setting temporary the correct class loader as a context class loader for the current thread, and now they pass. However if anybody knows the way to get the loader of the caller class (stack trace contains the name only - no use), it would be great to know it.

Regards
Audrius.

2005-10-13  Audrius Meskauskas  <address@hidden>

       * gnu/testlet/javax/rmi/CORBA/Tie/RMI_IIOP.java,
       gnu/testlet/org/omg/CORBA/ORB/DirectTest.java,
       gnu/testlet/org/omg/CORBA_2_3/ORB/ValueTypeTest.java,
gnu/testlet/org/omg/PortableInterceptor/Interceptor/testInterceptors.java: Set the thread context class loader to the loader that loaded that test.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]