I am trying to use a custom loader for a utility class for an Action class. This is not working. The utility tests fine off the net. When I get it on the net and in Tomcat, it breaks. The loader is for a hot deploy. The following is the code. Can anyone tell me why this breaks? It returns a good Class object but when initializing a variable for Class with Tomcat and Struts, it throws a null pointer exception. That is an odd thing, since nothing is null. But, I suspect it must be because of some classloader conflict. ANyone know?

The code for the classloading hot deploy factory is:

public static synchronized ResourceRetriever createResourceRetriever(ResourceRetriever template) {
if(resourceClass == null) {
reloadImpl();
}
ResourceRetriever newResourceRetriever = null;
try {
newResourceRetriever = (ResourceRetriever)resourceClass.newInstance();
} catch (InstantiationException ie) {
LogFactory.getLog(ResourceRetriever.class).error(ie.getMessage());
} catch (IllegalAccessException iae) {
LogFactory.getLog(ResourceRetriever.class).error(iae.getMessage());
}
return newResourceRetriever;
}


  public static synchronized void reloadImpl() {
    URL [] serverURLs = null;

    try {
      serverURLs = new URL[] { new URL("file:../hot_deploy/") };
    } catch (java.net.MalformedURLException mue) {
      LogFactory.getLog(ResourceRetriever.class).error(mue.getMessage());
    }

classLoader = new URLClassLoader(serverURLs);
try {
resourceClass = classLoader.loadClass("com.michaelmcgrady.resource.ResourceRetrieverImpl");
} catch (ClassNotFoundException cnfe) {
LogFactory.getLog(ResourceRetriever.class).error(cnfe.getMessage());
}


    return;
  }

Thanks.

Michael McGrady



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to