Hi
I am writing an application in which I use classloaders to load different
groups of plugins.
Basically what I am doing is:
protected Class findClass( String className )
throws ClassNotFoundException
{
if ( className.startsWith( "com.companyname." ) )
return getClass().getClassLoader().loadClass( className );
byte classData[] = getTypeFromBasePath( className );
if ( classData == null )
throw new ClassNotFoundException();
return defineClass( className, classData, 0, classData.length );
}
private byte[] getTypeFromBasePath( String typeName )
{
return Utils.readFile( classPath + typeName.replace( '.',
File.separatorChar ) + ".class" );
}
Now, I have problems an obvious problem with jar-files. [I have already
posted this before.]
[Actually I do not understand this problem, since it worked well with
tomcat4.0.6, but thats another problem. Still any hints are wellcome...]
What I would like to do is get rid of the getTypeFromBasePath-method. I
would prefer to let the parent classloader do this part and only do the
defineClass myself.
What I am doing right now seems to be bad practice event to me. But what
would be good practice?
The once thing I want to archive is that I want to load these classes with
different classloaders to be able to reload them during the lifetime of my
application.
Can anyone give me any hint?
Thanks,
Steffen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]