You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Charles <ch...@radworkz.com> on 2002/08/30 09:49:59 UTC

[ExceptionHandler] NoClassDefFoundError: org/apache/struts/action/ExceptionHandler

Hi,
I'm using declarative exception handling in struts 1.1. I have no problems
implementing them. However I want to display additional information of the
exception by getting the e.getMessage() and including it into the
ActionError object. I've read up Chuck 's chapter 10 on exception and used
SpecialExceptionHandler.java as reference in building my own
exceptionhandler class.

I've included the class in the struts-config.xml like this:

<global-exceptions>
<exception key="error.system" type="javax.ejb.FinderException"
path="/error.jsp"
handler="com.example.struts.exception.SpecialExceptionHandler"/>
</global-exceptions>

However when my application throws the javax.ejb.FinderException, instead of
running the SpecialExceptionHandler I get a NoClassDefFoundError for
org.apache.struts.action.ExceptionHandler.

Adding the struts.jar into the classpath would solve this problem but that
shouldn't be the way. Any ideas?

TIA,
Charles

p/s I'm using Weblogic 7.0 and ServletExec 4.1



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ExceptionHandler] NoClassDefFoundError: org/apache/struts/action/ExceptionHandler

Posted by Charles <ch...@radworkz.com>.
Btw..here's an except of the error message i get :

--------------------- start of exception ---------------------------------
Error. The server encountered an unexpected condition which prevented it
from fulfilling the request.


java.lang.NoClassDefFoundError: org/apache/struts/action/ExceptionHandler
	at java.lang.ClassLoader.defineClass0(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
	at java.lang.ClassLoader.findSystemClass(ClassLoader.java:673)
	at
com.newatlanta.servletexec.ApplClassLoader.loadClass(ApplClassLoader.java:40
1)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
	at
org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:193)
	at
org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:21
9)
	at
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.
java:496)
	at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
sor.java:431)
	at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1227)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:502)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
com.newatlanta.servletexec.ServletExec.CallServletService(ServletExec.java:1
650)
	at
com.newatlanta.servletexec.SERequestDispatcher.forwardServlet(SERequestDispa
tcher.java:274)
	at
com.newatlanta.servletexec.SERequestDispatcher.forward(SERequestDispatcher.j
ava:191)
	at
com.newatlanta.servletexec.ApplicationInfo.processApplRequest(ApplicationInf
o.java:1173)
	at
com.newatlanta.servletexec.ServerHostInfo.processApplRequest(ServerHostInfo.
java:941)
	at
com.newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.java:1206)
	at
com.newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.java:1056)
	at
com.newatlanta.servletexec.ServletExecService.processServletRequest(ServletE
xecService.java:165)
	at
com.newatlanta.servletexec.ServletExecService.Run(ServletExecService.java:19
7)
	at
com.newatlanta.servletexec.HttpServerRequest.run(HttpServerRequest.java:106)
------------------------------ end of exception
message ---------------------------------------------
and here's how my SpecialExceptionHandler looks like:


------------------------------------------ start of
SpecialExceptionHandler.java ----------------------------------
package com.example.struts.exception;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ExceptionHandler;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionError;
import org.apache.struts.util.AppException;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.config.ExceptionConfig;


public class SpecialExceptionHandler extends ExceptionHandler {

  public ActionForward execute(Exception ex,
                                  ExceptionConfig config,
                                  ActionMapping mapping,
                                  ActionForm formInstance,
                                  HttpServletRequest request,
                                  HttpServletResponse response)
    throws ServletException {
      ActionForward forward = null;
      ActionError error = null;
      String property = null;

      String path = null;
      if (config.getPath() != null) {
       path = config.getPath();
      }else{
        path = mapping.getInput();
      }
      forward = new ActionForward(path);

error = new ActionError(config.getKey(),ex);
property = error.getKey();
storeException(request, property, error, forward, config.getScope());

      return forward;
    }
}

------------------------------------- end of
SpecialExceptionHandler -----------------------------

----- Original Message -----
From: "Charles" <ch...@radworkz.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, August 30, 2002 3:49 PM
Subject: [ExceptionHandler] NoClassDefFoundError:
org/apache/struts/action/ExceptionHandler


> Hi,
> I'm using declarative exception handling in struts 1.1. I have no problems
> implementing them. However I want to display additional information of the
> exception by getting the e.getMessage() and including it into the
> ActionError object. I've read up Chuck 's chapter 10 on exception and used
> SpecialExceptionHandler.java as reference in building my own
> exceptionhandler class.
>
> I've included the class in the struts-config.xml like this:
>
> <global-exceptions>
> <exception key="error.system" type="javax.ejb.FinderException"
> path="/error.jsp"
> handler="com.example.struts.exception.SpecialExceptionHandler"/>
> </global-exceptions>
>
> However when my application throws the javax.ejb.FinderException, instead
of
> running the SpecialExceptionHandler I get a NoClassDefFoundError for
> org.apache.struts.action.ExceptionHandler.
>
> Adding the struts.jar into the classpath would solve this problem but that
> shouldn't be the way. Any ideas?
>
> TIA,
> Charles
>
> p/s I'm using Weblogic 7.0 and ServletExec 4.1
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>