Hello,

When I try to use the ActionMessage class in a class that is not an
Action or Form, I get a ClassNotFoundException. 

I have the following function in a common utility class.  
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMessage;

        public static void creatNetfError(String errorCode, ActionErrors
errors)
        {
                if (errorCode == null)
                        errors.add("keyError", new
ActionMessage("title.error.msg"));
                else
                {
                        errors.add("title", new
ActionMessage("title.error.msg", errorCode));
                        errors.add("description", new
ActionMessage("error.msg"+errorCode));
                }
        }

Then call it in my Action class:
                ActionErrors errors = new ActionErrors();
        
CommonUtil.creatNetfError(request.getParameter("errorCode"), errors);
                this.saveErrors(request, errors);

I get the following two exceptions (expanded format at the end of
email):
java.lang.NoClassDefFoundError: org/apache/struts/action/ActionMessage 
java.lang.ClassNotFoundException: org.apache.struts.action.ActionMessage

This seems to happen if I call org.apache.struts.util.MessageResources,
or org.apache.struts.util.ActionErrors in an outside helper class as
well. I haven't seen anything in the documentation discouraging use of
this package in other classes. Am I missing something? Usually when I
get a ClassNotFoundException it is because I am missing a jar file, but
in this case I am able to use the classes directly in the Action so that
leads me to believe the jar file is installed correctly. Is it possible
it is installed incorrectly?

Can anybody point my search in the right direction please? 

Thank you

Alfreda

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to