From a MicrocontainerTestDelegate, I have created a parent policy for
the default domain that excludes all classes from package excludes. Now, if you try to do
a domain.loadClass(A.class.getName()), for example, it will return null as expected. So
far so good.
But this does not seem to be enough. All tests are failing because of
TestScenario.cannotLoadClass(L loader, String className).
This method asserts that loader cannot load className. It is failing because the default
domain enters this block:
BaseClassLoaderPolicy policy = classLoader.getPolicy();
| ClassLoader hack = policy.isJDKRequest(name);
| if (hack != null)
| {
| if (trace)
| log.trace(this + " trying to load " + name + " using hack "
+ hack);
| Class<?> result = Class.forName(name, false, hack);
| if (result != null)
| {
| if (trace)
| log.trace(this + " loaded from hack " + hack + " " +
ClassLoaderUtils.classToString(result));
| globalClassCache.put(path, new ClassCacheItem(result));
| return result;
| }
| }
So I thought: adding the class to the JDKChecker.getExcludes collection should do the
trick. The requesting class returned by AbstractJDKChecker.getRequestingClass() is
SanityTestScenario. Adding this class to the excludes collection also causes the tests to
fail. Now, calls to classLoader.loadClass(String className), that should return a class
loaded by a BaseClassLoader, are returning a class loaded by the AppClassLoader.
Does anybody has any ideas of a possible workaround to this?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269079#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...