Gentlemen, I hope you
will be able to assist me with a Tomcat Class Loader problem I am
experiencing. I am using: Apache Tomcat: 4.0.1 JDK: 1.4.1_02 Running on Windows 2000
Server. I have the
following java
code: import java.util.*; public class ActionFactory { private Hashtable actions = new Hashtable(); // This method is
called by the action sevlet public Action getAction(String classname, ClassLoader
loader) throws
IllegalAccessException, InstantiationException
{ Class klass =
null; System.out.println("Executing - ActionFactory"); System.out.println(" ActionFactory - getAction"); System.out.println(" AF getAction - classname: " + classname); Action action
= (Action)actions.get(classname); System.out.println(" getAction - got action:
" + action); if(action ==
null) { try { System.out.println(" getAction -
loading action class"); System.out.println(" loader: " + loader); klass = loader.loadClass(classname); System.out.println(" getAction - class
loaded successfully"); } catch (ClassNotFoundException
cnfe) { System.out.println(" Couldn't find class: " + classname); System.out.println(" loader: " + loader); System.out.println(" " + cnfe.getMessage()); } System.out.println(" getAction -
creating new class instance"); action =
(Action)klass.newInstance(); System.out.println(" getAction -
adding action to actions table"); actions.put(classname, action); } return action; } // getAction() As you can
see, I have placed a lot of extra line in the code that allow
me to determine the source of the problem. The
following line, in the TRY block, seems to be the problem: klass = loader.loadClass(classname); In this
line, "classname" = actions.ValidateURegFormAction. I checked
that the class exists in the /WEB-INF/class/actions directory. However execution of this line never
returns. It seems that it stays trying
to find and load the class. Can you
please assist with this problem. Should I increase the value to wait before
the request times out? If so, how can I
do this? Do you have any suggestions? Gabriel S.
Lobo-Blanco |