I know that we can dynamically load classes using custom class loaders. But here my problem is that my class itself is dependent on other classes.
My task is to get the PigServer object. So I used the following code to load the PigServer class
_pigServerClass = _classLoader.loadClass("org.apache.pig.PigServer");
But here the PigServer class itself depends on many other classes.
Therefore, when I try to get an instance of the PigServer class, it shows the following errors
java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
java.lang.ClassNotFoundException:org.apache.log4j.AppenderSkeleton
etc..
Can anyone tell how to solve this?
source
share