You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Lobo-Blanco, Gabriel" <Ga...@IDEA.com> on 2003/06/12 18:40:29 UTC

Tomcat Class Loader

 
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 
Idea Integration
1 Independent Drive Suite 206
Jacksonville, FL 32202
Direct: 904.360.2461
Fax: 904.360.2490
www.idea.com <http://www.idea.com> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Privacy Notice:
Unless expressly stated otherwise, this e-mail is confidential and may be
privileged.  it is intended solely for the addressee(s).  Access to this
e-mail by anyone else in unauthorized.  If you are no an addressee, any
disclosure or copying of the contents of this e-mail or any action taken (or
not taken) in reliance on it is unauthorized and may be unlawful.  If your
name is not listed and you received this e-mail please delete it and notify
the sender.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~