You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by gfdgdf gdfgdf <fr...@yahoo.it> on 2004/09/16 14:16:15 UTC

How to use a class loaded with a Custom ClassLoader

Hi all.
I have a web application with sensitive information inside a class. To protect it, I have encrypted the class and written a custom classloader in order to load and decrypt it.
The class itself is "masked" with an interface which has a method which returns an instance of the class.
 
The class is successfully loaded in the Context listener event:
 
 public void contextInitialized(ServletContextEvent event)
  {
      CustomLoader c = new CustomLoader(context.getClass().getClassLoader());
          Class clazz = c.loadClass("C:\\jakarta-tomcat-5.0.16\\temp\\","SecretClass",true);
     
 
The problem is, when the application tries to reference the SecretClass a ClassnotFoundException is thrown.......
Why Tomcat cannot use the class I have loaded in memory before ?
What can I do to solve the problem ?
I'm using Tomcat 5.0.16 as container.
 
Hope somebody can help
Regards
Francesco

				
---------------------------------
Scopri Mister Yahoo! -  il fantatorneo sul calcio di Yahoo! Sport'