See below.

On Wed, 27 Nov 2002, Stephen Riek wrote:

> Date: Wed, 27 Nov 2002 05:55:11 +0000 (GMT)
> From: Stephen Riek <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: Tomcat Filter with RequestDispatcher  -
>     IncompatibleClassChangeError
>
>
> I've been at this for the better half of a day already
> without joy.  Am trying to create a Filter which accepts
> a request for "/fr/Products/Toys/index.jsp" and forwards
> the request to "/Products/Toys/index.jsp" after setting
> an attribute "lang" to "fr".
>
> However, no matter what I try, the following error is
> produced: "java.lang.IncompatibleClassChangeError".
> I have tested the URL "/Products/Toys/index.jsp" directly
> in a browser and there is no problem with it, and using
> System.out.println calls, I have deduced that the error
> lies in the rd.forward(request, response) line.
>
> Does anybody have any idea why this may be happening?
> I'm using Tomcat4.0
>
>
> Filter Source Code
> ------------------
>
> public final class LanguageFilter implements Filter {
>
> private FilterConfig filterConfig = null;
>
> public void init(FilterConfig filterConfig) {
>    this.filterConfig = filterConfig;
> }
>
> public void doFilter(ServletRequest request, ServletResponse response, FilterChain 
>chain) throws IOException, ServletException {
>     String servletPath = ((HttpServletRequest) request).getServletPath();
>     // If path starts with "/fr/", set the lang to "fr".
>     if (servletPath.indexOf("/fr/") == 0) {
>     request.setAttribute("lang", "fr");
>     String targetURL = servletPath.substring(3);

You probably don't want to do this *unless* the path starts with "/fr",
right?

>     System.out.println("targetURL = " + targetURL);
>     RequestDispatcher rd = null;
>     ServletContext sc = this.filterConfig.getServletContext();
>     rd = sc.getRequestDispatcher(targetURL);
>     System.out.println("ok, RequestDispatcher created");
>     if (rd!=null) {
>         rd.forward(request, response);
>         return;
>     }
>     chain.doFilter(request, response);
> }
>
>
>
> Error Trace
> -----------
>
> java.lang.IncompatibleClassChangeError

This exception normally means you have made a change in a superclass and
recompiled it, but not recompiled a subclass that depends on the old APIs.

> at mas.TestFilter.doFilter(Store/LanguageFilter.java:35)

What is "Store"?  Is that supposed to be the package name?

You should recompile *all* your classes to catch any cases where you've
made incompatible changes.

> at 
>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
> at 
>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
> at 
>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
> at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
> at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>
> Thank you for helping,
>
> Stephen.
>

Craig


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

Reply via email to