Problem with dynamic class loading
Hi,
We have a class file in an external jar(outside ear) and access it in an ear using classloader.loadClass method. But if the class file is changed in jar, it gets hotdeployed in jboss but code which calls this class still refers to the old code.
Class getClassByName(String className) throws ClassNotFoundException {
Class theClass = null;
try {
theClass = Thread.currentThread().getContextClassLoader().loadClass(className);
} catch (ClassNotFoundException e) {
theClass = getClass().getClassLoader().loadClass(className);
}
return theClass;
}
When I looked into api I came to know that loadClass actually loads the class if it is not already exists. Can any one help me in writing thecustom class loader which loads the class everytime instead of checking previous instance before loading......
Thanks,
Kruthika

